mirror of
https://github.com/danog/amp.git
synced 2024-11-27 04:24:42 +01:00
c7e4e8d0c3
- Combinator functions optimized for performance - Amp\reactor() now accepts an optional assignment parameter for modifying the global default event reactor instance to allow for third-party Reactor implementations. - Renamed functions: . Amp\getReactor() -> Amp\reactor() - Removed functions: . Amp\chooseReactor() . Amp\tick() . Amp\immediately() . Amp\once() . Amp\repeat() . Amp\onReadable() . Amp\onWritable() . Amp\onSignal() . Amp\enable() . Amp\disable() . Amp\cancel()
19 lines
493 B
PHP
19 lines
493 B
PHP
<?php
|
|
|
|
namespace Amp;
|
|
|
|
class Pause implements Promise {
|
|
use Placeholder;
|
|
|
|
public function __construct($msTimeout, Reactor $reactor = null) {
|
|
if ($msTimeout < 1) {
|
|
throw new \DomainException(sprintf(
|
|
"Pause timeout must be greater than or equal to 1 millisecond; %d provided",
|
|
$msTimeout
|
|
));
|
|
}
|
|
$reactor = $reactor ?: reactor();
|
|
$reactor->once(function() { $this->resolve(); }, $msTimeout);
|
|
}
|
|
}
|