Add autoclose option to popups

This commit is contained in:
2022-07-25 22:52:22 +00:00
parent 947735292a
commit b71197d003
5 changed files with 67 additions and 24 deletions

View File

@@ -6,20 +6,23 @@ export const ActivityMixin = (SuperClass) => {
constructor() {
super();
for (const ev of ["pointerdown", "pointermove", "keydown"]) {
window.addEventListener(ev, () => this.activityTrigger());
window.addEventListener(ev, () => this.activityTrigger(true));
}
this.addEventListener("fully-update", () => {
this.activityTrigger();
});
}
activityTrigger() {
activityTrigger(touched = false) {
if (!this.activityTriggered) {
this.sendUpdate({
activity: true,
});
}
this.activityTriggered = true;
if (touched) {
this.fireEvent("browser-mod-activity");
}
clearTimeout(this._activityTimeout);
this._activityTimeout = setTimeout(
() => this.activityReset(),