File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,8 @@ Table of Contents
3737 * [ When::reject()] ( #whenreject )
3838 * [ When::lazy()] ( #whenlazy )
3939 * [ Promisor] ( #promisor )
40+ * [ CancellablePromiseInterface] ( #cancellablepromiseinterface )
41+ * [ CancellablePromiseInterface::cancel()] ( #cancellablepromiseinterfacecancel )
40424 . [ Examples] ( #examples )
4143 * [ How to use Deferred] ( #how-to-use-deferred )
4244 * [ How Promise forwarding works] ( #how-promise-forwarding-works )
@@ -484,6 +486,24 @@ The `React\Promise\PromisorInterface` provides a common interface for objects
484486that provide a promise. ` React\Promise\Deferred ` implements it, but since it
485487is part of the public API anyone can implement it.
486488
489+ ### CancellablePromiseInterface
490+
491+ A cancellable promise provides a mechanism for consumers to notify the creator
492+ of the promise that they are not longer interested in the result of an
493+ operation.
494+
495+ #### CancellablePromiseInterface::cancel()
496+
497+ ``` php
498+ $promise->cancel();
499+ ```
500+
501+ The ` cancel() ` method notifies the creator of the promise that there is no
502+ further interest in the results of the operation.
503+
504+ Once a promise is settled (either resolved or rejected), calling ` cancel() ` on
505+ a promise has no effect.
506+
487507Examples
488508--------
489509
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace React \Promise ;
4+
5+ interface CancellablePromiseInterface extends PromiseInterface
6+ {
7+ /**
8+ * @return void
9+ */
10+ public function cancel ();
11+ }
You can’t perform that action at this time.
0 commit comments