@@ -13,6 +13,7 @@ export function getUnarchiver(ab: ArrayBuffer, options?: UnarchiverOptions | str
1313/**
1414 * All extracted files returned by an Unarchiver will implement
1515 * the following interface:
16+ * TODO: Move this interface into common.js?
1617 */
1718/**
1819 * @typedef UnarchivedFile
@@ -37,7 +38,7 @@ export class Unarchiver extends EventTarget {
3738 */
3839 constructor ( arrayBuffer : ArrayBuffer , options ?: UnarchiverOptions | string ) ;
3940 /**
40- * The client-side port that sends messages to, and receives messages from the
41+ * The client-side port that sends messages to, and receives messages from, the
4142 * decompressor implementation.
4243 * @type {MessagePort }
4344 * @private
@@ -61,12 +62,30 @@ export class Unarchiver extends EventTarget {
6162 */
6263 debugMode_ : boolean ;
6364 /**
64- * Overridden so that the type hints for eventType are specific.
65+ * Overridden so that the type hints for eventType are specific. Prefer onExtract(), etc.
6566 * @param {'progress'|'extract'|'finish' } eventType
6667 * @param {EventListenerOrEventListenerObject } listener
6768 * @override
6869 */
6970 override addEventListener ( eventType : 'progress' | 'extract' | 'finish' , listener : EventListenerOrEventListenerObject ) : void ;
71+ /**
72+ * Type-safe way to subscribe to an UnarchiveExtractEvent.
73+ * @param {function(UnarchiveExtractEvent) } listener
74+ * @returns {Unarchiver } for chaining.
75+ */
76+ onExtract ( listener : ( arg0 : UnarchiveExtractEvent ) => any ) : Unarchiver ;
77+ /**
78+ * Type-safe way to subscribe to an UnarchiveFinishEvent.
79+ * @param {function(UnarchiveFinishEvent) } listener
80+ * @returns {Unarchiver } for chaining.
81+ */
82+ onFinish ( listener : ( arg0 : UnarchiveFinishEvent ) => any ) : Unarchiver ;
83+ /**
84+ * Type-safe way to subscribe to an UnarchiveProgressEvent.
85+ * @param {function(UnarchiveProgressEvent) } listener
86+ * @returns {Unarchiver } for chaining.
87+ */
88+ onProgress ( listener : ( arg0 : UnarchiveProgressEvent ) => any ) : Unarchiver ;
7089 /**
7190 * This method must be overridden by the subclass to return the script filename.
7291 * @returns {string } The MIME type of the archive.
@@ -88,7 +107,6 @@ export class Unarchiver extends EventTarget {
88107 private createUnarchiveEvent_ ;
89108 /**
90109 * Receive an event and pass it to the listener functions.
91- *
92110 * @param {Object } obj
93111 * @returns {boolean } Returns true if the decompression is finished.
94112 * @private
0 commit comments