More precise typing in TransferredFile.event.

This commit is contained in:
Juliusz Chroboczek
2025-01-05 23:36:11 +01:00
parent b077ae786f
commit 7ae11a8e54
+5 -2
View File
@@ -1573,6 +1573,9 @@ Stream.prototype.setStatsInterval = function(ms) {
}, ms);
};
/**
* @typedef {"" | "inviting" | "connecting" | "connected" | "done" | "cancelled" | "closed"} TransferredFileState
*/
/**
* A file in the process of being transferred.
@@ -1703,7 +1706,7 @@ function TransferredFile(sc, userid, id, up, username, name, mimetype, size) {
* in order to display a progress bar. Call this.cancel in order
* to cancel the transfer.
*
* @type {(this: TransferredFile, type: string, [data]: string) => void}
* @type {(this: TransferredFile, state: TransferredFileState, [data]: string) => void}
*/
this.onevent = null;
}
@@ -1799,7 +1802,7 @@ TransferredFile.prototype.getBufferedData = function() {
* This calls the callback even if the state didn't change, which is
* useful if the client needs to display a progress bar.
*
* @param {string} state
* @param {TransferredFileState} state
* @param {any} [data]
*/
TransferredFile.prototype.event = function(state, data) {