Skip to content

Commit 31a054e

Browse files
tykus160joeyparrish
authored andcommitted
chore: Convert IAbortableOperation to ES6 (#7623)
1 parent 1a3ad1b commit 31a054e

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

externs/shaka/abortable.js

+36-36
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,39 @@
1818
* @template T
1919
* @exportDoc
2020
*/
21-
shaka.extern.IAbortableOperation = function() {};
22-
23-
24-
/**
25-
* A Promise which represents the underlying operation. It is resolved when
26-
* the operation is complete, and rejected if the operation fails or is
27-
* aborted. Aborted operations should be rejected with a shaka.util.Error
28-
* object using the error code OPERATION_ABORTED.
29-
*
30-
* @const {!Promise.<T>}
31-
* @exportDoc
32-
*/
33-
shaka.extern.IAbortableOperation.prototype.promise;
34-
35-
36-
/**
37-
* Can be called by anyone holding this object to abort the underlying
38-
* operation. This is not cancelation, and will not necessarily result in
39-
* any work being undone. abort() should return a Promise which is resolved
40-
* when the underlying operation has been aborted. The returned Promise
41-
* should never be rejected.
42-
*
43-
* @return {!Promise}
44-
* @exportDoc
45-
*/
46-
shaka.extern.IAbortableOperation.prototype.abort = function() {};
47-
48-
49-
/**
50-
* @param {function(boolean)} onFinal A callback to be invoked after the
51-
* operation succeeds or fails. The boolean argument is true if the operation
52-
* succeeded and false if it failed.
53-
* @return {!shaka.extern.IAbortableOperation.<T>} Returns this.
54-
* @exportDoc
55-
*/
56-
shaka.extern.IAbortableOperation.prototype.finally = function(onFinal) {};
21+
shaka.extern.IAbortableOperation = class {
22+
constructor() {
23+
/**
24+
* A Promise which represents the underlying operation. It is resolved when
25+
* the operation is complete, and rejected if the operation fails or is
26+
* aborted. Aborted operations should be rejected with a shaka.util.Error
27+
* object using the error code OPERATION_ABORTED.
28+
*
29+
* @const {!Promise.<T>}
30+
* @exportDoc
31+
*/
32+
this.promise;
33+
}
34+
35+
/**
36+
* Can be called by anyone holding this object to abort the underlying
37+
* operation. This is not cancelation, and will not necessarily result in
38+
* any work being undone. abort() should return a Promise which is resolved
39+
* when the underlying operation has been aborted. The returned Promise
40+
* should never be rejected.
41+
*
42+
* @return {!Promise}
43+
* @exportDoc
44+
*/
45+
abort() {}
46+
47+
48+
/**
49+
* @param {function(boolean)} onFinal A callback to be invoked after the
50+
* operation succeeds or fails. The boolean argument is true
51+
* if the operation succeeded and false if it failed.
52+
* @return {!shaka.extern.IAbortableOperation.<T>} Returns this.
53+
* @exportDoc
54+
*/
55+
finally(onFinal) {}
56+
};

0 commit comments

Comments
 (0)