<?php
namespace React\Promise;
class Deferred implements PromisorInterface
{
private $promise;
private $resolveCallback;
private $rejectCallback;
private $notifyCallback;
private $canceller;
public function __construct(callable $canceller = null)
{
$this->canceller = $canceller;
}
public function promise()
{
if (null === $this->promise) {
$this->promise = new Promise(function ($resolve, $reject, $notify) {
$this->resolveCallback = $resolve;
$this->rejectCallback = $reject;
$this->notifyCallback = $notify;
}, $this->canceller);
}
return $this->promise;
}
public function resolve($value = null)
{
$this->promise();
call_user_func($this->resolveCallback, $value);
}
public function reject($reason = null)
{
$this->promise();
call_user_func($this->rejectCallback, $reason);
}
public function notify($update = null)
{
$this->promise();
call_user_func($this->notifyCallback, $update);
}
/**
* @deprecated 2.2.0
* @see Deferred::notify()
*/
public function progress($update = null)
{
$this->notify($update);
}
}
| nama | waktu | ukuran | owner | perm | aksi |
|---|---|---|---|---|---|
| .. | |||||
| Exception/ | 2016-11-07 15:55 | 94 B | 76129f60960:kunden | dxwrx-rx-r | |
| CancellablePromiseInterface.php | 2016-11-07 15:54 | 166 B | 76129f60960:kunden | -xw-x----- | |
| CancellationQueue.php | 2016-11-07 15:54 | 1.08 KB | 76129f60960:kunden | -xw-x----- | |
| Deferred.php | 2016-11-07 15:54 | 1.27 KB | 76129f60960:kunden | -xw-x----- | |
| ExtendedPromiseInterface.php | 2016-11-07 15:54 | 584 B | 76129f60960:kunden | -xw-x----- | |
| FulfilledPromise.php | 2016-11-07 15:54 | 1.74 KB | 76129f60960:kunden | -xw-x----- | |
| LazyPromise.php | 2016-11-07 15:54 | 1.56 KB | 76129f60960:kunden | -xw-x----- | |
| Promise.php | 2016-11-07 15:54 | 5.47 KB | 76129f60960:kunden | -xw-x----- | |
| PromiseInterface.php | 2016-11-07 15:54 | 226 B | 76129f60960:kunden | -xw-x----- | |
| PromisorInterface.php | 2016-11-07 15:54 | 144 B | 76129f60960:kunden | -xw-x----- | |
| RejectedPromise.php | 2016-11-07 15:54 | 2.06 KB | 76129f60960:kunden | -xw-x----- | |
| UnhandledRejectionException.php | 2016-11-07 15:54 | 611 B | 76129f60960:kunden | -xw-x----- | |
| functions.php | 2016-11-07 15:54 | 8.46 KB | 76129f60960:kunden | -xw-x----- | |
| functions_include.php | 2016-11-07 15:54 | 96 B | 76129f60960:kunden | -xw-x----- | |