Skip to content

Commit 1fab6b1

Browse files
committed
Updates types after adding onExtract, etc
1 parent 426741a commit 1fab6b1

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ All notable changes to this project will be documented in this file.
88

99
- archive: Support semantic methods for subscribing to unarchive events (onExtract), [Issue #47](https://github.com/codedread/bitjs/issues/47).
1010

11+
### Changed
12+
13+
- archive: Error on RAR5 files.
1114

1215
## [1.2.2] - 2024-01-26
1316

types/archive/decompress.d.ts

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

types/archive/decompress.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)