Constructor
new CancelableChain()
A Promise-based abstraction that creates cancelable Promise chains.
When canceled, subsequent stages of the internal Promise chain will stop.
A canceled chain is rejected with a user-specified value.
A CancelableChain only supports linear Promise chains. Chains which branch
(more than one then() handler chained to a particular stage) are not
supported. You will not be prevented from treating this as if branching
were supported, but everything will be serialized into a linear chain.
Be careful!
- Source:
Members
-
(private) canceled_ :boolean
-
Type:
- boolean
- Source:
-
(private, non-null) cancelPromise_ :Promise
-
Type:
- Promise
- Source:
-
(private) complete_ :boolean
-
Type:
- boolean
- Source:
-
(private) final_ :boolean
-
Type:
- boolean
- Source:
-
(private) onCancelComplete_ :function()
-
Type:
- function()
- Source:
-
(private, non-null) promise_ :Promise
-
Type:
- Promise
- Source:
-
(private) rejectionValue_ :shaka.util.Error
-
Type:
- Source:
Methods
-
cancel(reasonnon-null) → (non-null) {Promise}
-
Cancel the Promise chain and reject with the given value.
Parameters:
Name Type Description reason
shaka.util.Error - Source:
Returns:
resolved when the cancelation has been processed by the the chain and no more stages will execute. Note that this may be before the owner of the finalized chain has seen the rejection.- Type
- Promise
-
finalize() → (non-null) {Promise}
-
Finalize the chain. Converts the chain into a simple Promise and stops accepting new stages.
- Source:
Returns:
- Type
- Promise
-
then(callback) → (non-null) {shaka.util.CancelableChain}
-
Parameters:
Name Type Description callback
function(*) - Source:
Returns:
the chain itself.