diff --git a/public/scripts/network.js b/public/scripts/network.js index 55fdc89..01eb27d 100644 --- a/public/scripts/network.js +++ b/public/scripts/network.js @@ -893,11 +893,11 @@ class Events { window.dispatchEvent(new CustomEvent(type, { detail: detail })); } - static on(type, callback) { - return window.addEventListener(type, callback, false); + static on(type, callback, options = false) { + return window.addEventListener(type, callback, options); } - static off(type, callback) { - return window.removeEventListener(type, callback, false); + static off(type, callback, options = false) { + return window.removeEventListener(type, callback, options); } } diff --git a/public/scripts/ui.js b/public/scripts/ui.js index 62c1f83..340b22b 100644 --- a/public/scripts/ui.js +++ b/public/scripts/ui.js @@ -241,7 +241,7 @@ class PeersUI { const _callback = (e) => this._sendClipboardData(e, files, text); Events.on('paste-pointerdown', _callback); - Events.on('deactivate-paste-mode', _ => this._deactivatePasteMode(_callback)); + Events.on('deactivate-paste-mode', _ => this._deactivatePasteMode(_callback), { once: true }); this.$cancelPasteModeBtn.removeAttribute('hidden'); diff --git a/public_included_ws_fallback/scripts/network.js b/public_included_ws_fallback/scripts/network.js index 4c5b255..b805654 100644 --- a/public_included_ws_fallback/scripts/network.js +++ b/public_included_ws_fallback/scripts/network.js @@ -974,11 +974,11 @@ class Events { window.dispatchEvent(new CustomEvent(type, { detail: detail })); } - static on(type, callback) { - return window.addEventListener(type, callback, false); + static on(type, callback, options = false) { + return window.addEventListener(type, callback, options); } - static off(type, callback) { - return window.removeEventListener(type, callback, false); + static off(type, callback, options = false) { + return window.removeEventListener(type, callback, options); } } diff --git a/public_included_ws_fallback/scripts/ui.js b/public_included_ws_fallback/scripts/ui.js index b1f666b..0227167 100644 --- a/public_included_ws_fallback/scripts/ui.js +++ b/public_included_ws_fallback/scripts/ui.js @@ -241,7 +241,7 @@ class PeersUI { const _callback = (e) => this._sendClipboardData(e, files, text); Events.on('paste-pointerdown', _callback); - Events.on('deactivate-paste-mode', _ => this._deactivatePasteMode(_callback)); + Events.on('deactivate-paste-mode', _ => this._deactivatePasteMode(_callback), { once: true }); this.$cancelPasteModeBtn.removeAttribute('hidden');