diff --git a/externs/shaka/abortable.js b/externs/shaka/abortable.js index 474a866826..21c6f3e3de 100644 --- a/externs/shaka/abortable.js +++ b/externs/shaka/abortable.js @@ -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.} - * @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.} 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.} + * @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.} Returns this. + * @exportDoc + */ + finally(onFinal) {} +};