Constructor
(export) new AbortableOperation(promisenon-null, onAbort)
Parameters:
Name | Type | Description |
---|---|---|
promise |
Promise.<T> | A Promise which represents the underlying operation. It is resolved when the operation is complete, and rejected if the operation fails or is aborted. Aborted operations should be rejected with a shaka.util.Error object using the error code OPERATION_ABORTED. |
onAbort |
function | Will be called by this object to abort the underlying operation. This is not cancelation, and will not necessarily result in any work being undone. abort() should return a Promise which is resolved when the underlying operation has been aborted. The returned Promise should never be rejected. |
- Implements:
- Source:
Members
(private) onAbort_ :function():!Promise
Type:
- function():!Promise
- Source:
(constant, non-null) promise :Promise.<T>
Type:
- Promise.<T>
- Source:
(export, constant, non-null) promise :Promise.<T>
Type:
- Promise.<T>
- Source:
Methods
(export, static) aborted() → (non-null) {shaka.util.AbortableOperation}
- Source:
Returns:
An operation which has already
failed with the error OPERATION_ABORTED.
(export, static) all(operationsnon-null) → (non-null) {shaka.util.AbortableOperation}
Parameters:
Name | Type | Description |
---|---|---|
operations |
Array.<!shaka.util.AbortableOperation> |
- Source:
Returns:
An operation which is resolved
when all operations are successful and fails when any operation fails.
For this operation, abort() aborts all given operations.
(export, static) completed(value) → (non-null) {shaka.util.AbortableOperation.<U>}
Parameters:
Name | Type | Description |
---|---|---|
value |
U |
- Source:
Returns:
An operation which has already
completed with the given value.
- Type
- shaka.util.AbortableOperation.<U>
(export, static) failed(errornon-null) → (non-null) {shaka.util.AbortableOperation}
Parameters:
Name | Type | Description |
---|---|---|
error |
shaka.util.Error |
- Source:
Returns:
An operation which has already
failed with the error given by the caller.
(export, static) notAbortable(promisenon-null) → (non-null) {shaka.util.AbortableOperation.<U>}
Parameters:
Name | Type | Description |
---|---|---|
promise |
Promise.<U> |
- Source:
Returns:
An operation which cannot be
aborted. It will be completed when the given Promise is resolved, or
will be failed when the given Promise is rejected.
- Type
- shaka.util.AbortableOperation.<U>
(private, static) wrapChainCallback_(callback, value, newPromisenon-null) → {function():!Promise}
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | function | function | function | A callback to be invoked with the given value. |
value |
T | |
newPromise |
shaka.util.PublicPromise | The promise for the next stage in the chain. |
- Source:
Returns:
The next abort() function for the chain.
- Type
- function():!Promise
(export) abort()
- Source:
(export) chain(onSuccess, onErroropt) → (non-null) {shaka.util.AbortableOperation.<U>}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
onSuccess |
undefined | function | function | function | A callback to be invoked after this operation is complete, to chain to another operation. The callback can return a plain value, a Promise to an asynchronous value, or another AbortableOperation. | |
onError |
function(*)= |
<optional> |
An optional callback to be invoked if this operation fails, to perform some cleanup or error handling. Analogous to the second parameter of Promise.prototype.then. |
- Source:
Returns:
An operation which is resolved
when this operation and the operation started by the callback are both
complete.
- Type
- shaka.util.AbortableOperation.<U>
(export) finally()
- Source: