Skip to content

Commit

Permalink
chore: Convert IAbortableOperation to ES6 (#7623)
Browse files Browse the repository at this point in the history
  • Loading branch information
tykus160 authored and joeyparrish committed Nov 19, 2024
1 parent 1a3ad1b commit 31a054e
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions externs/shaka/abortable.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,39 +18,39 @@
* @template T
* @exportDoc
*/
shaka.extern.IAbortableOperation = function() {};


/**
* 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.
*
* @const {!Promise.<T>}
* @exportDoc
*/
shaka.extern.IAbortableOperation.prototype.promise;


/**
* Can be called by anyone holding 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.
*
* @return {!Promise}
* @exportDoc
*/
shaka.extern.IAbortableOperation.prototype.abort = function() {};


/**
* @param {function(boolean)} onFinal A callback to be invoked after the
* operation succeeds or fails. The boolean argument is true if the operation
* succeeded and false if it failed.
* @return {!shaka.extern.IAbortableOperation.<T>} Returns this.
* @exportDoc
*/
shaka.extern.IAbortableOperation.prototype.finally = function(onFinal) {};
shaka.extern.IAbortableOperation = class {
constructor() {
/**
* 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.
*
* @const {!Promise.<T>}
* @exportDoc
*/
this.promise;
}

/**
* Can be called by anyone holding 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.
*
* @return {!Promise}
* @exportDoc
*/
abort() {}


/**
* @param {function(boolean)} onFinal A callback to be invoked after the
* operation succeeds or fails. The boolean argument is true
* if the operation succeeded and false if it failed.
* @return {!shaka.extern.IAbortableOperation.<T>} Returns this.
* @exportDoc
*/
finally(onFinal) {}
};

0 comments on commit 31a054e

Please sign in to comment.