add { once: true } to deactivate-paste-mode event listener

This commit is contained in:
schlagmichdoch 2023-03-06 11:59:56 +01:00
parent fdf024f378
commit 36e152dc7c
4 changed files with 10 additions and 10 deletions

View file

@ -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);
}
}

View file

@ -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');

View file

@ -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);
}
}

View file

@ -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');