From 7ae11a8e54db6bdd9d12a2ffb1441b50a6dc6129 Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Sun, 5 Jan 2025 23:36:11 +0100 Subject: [PATCH] More precise typing in TransferredFile.event. --- static/protocol.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/static/protocol.js b/static/protocol.js index 8bf974f..37ce64a 100644 --- a/static/protocol.js +++ b/static/protocol.js @@ -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) {