Added: addEventsListener() and addEventsListeners()

This commit is contained in:
the-djmaze 2022-02-24 11:19:19 +01:00
parent c270f0ad9a
commit 5990addfef
14 changed files with 484 additions and 464 deletions

View file

@ -19,7 +19,8 @@ import {
$htmlCL,
Settings,
SettingsGet,
leftPanelDisabled
leftPanelDisabled,
addEventsListener
} from 'Common/Globals';
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
@ -89,7 +90,7 @@ class AppUser extends AbstractApp {
}, interval);
const fn = (ev=>$htmlCL.toggle('rl-ctrl-key-pressed', ev.ctrlKey)).debounce(500);
['keydown','keyup'].forEach(t => doc.addEventListener(t, fn));
addEventsListener(doc, ['keydown','keyup'], fn);
shortcuts.add('escape,enter', '', Scope.All, () => rl.Dropdowns.detectVisibility());
}
@ -344,9 +345,7 @@ class AppUser extends AbstractApp {
}
// add pointermove ?
['touchstart','mousemove','keydown'].forEach(
t => doc.addEventListener(t, SettingsUserStore.delayLogout, {passive:true})
);
addEventsListener(doc, ['touchstart','mousemove','keydown'], SettingsUserStore.delayLogout, {passive:true});
SettingsUserStore.delayLogout();
// initLeftSideLayoutResizer