diff --git a/panel/src/ts/components/inputs/date-input.ts b/panel/src/ts/components/inputs/date-input.ts index 6d869c5d4..47c105dd6 100644 --- a/panel/src/ts/components/inputs/date-input.ts +++ b/panel/src/ts/components/inputs/date-input.ts @@ -19,7 +19,7 @@ function handleLongClick(element: HTMLElement, callback: (event: MouseEvent) => clear(); } else { callback.call(context, event); - timer = setTimeout(() => (timer = setInterval(callback.bind(context, event), interval)), timeout); + timer = window.setTimeout(() => (timer = window.setInterval(callback.bind(context, event), interval)), timeout); } }); element.addEventListener("mouseout", clear); diff --git a/panel/src/ts/components/inputs/editor/markdown/linktooltip.ts b/panel/src/ts/components/inputs/editor/markdown/linktooltip.ts index 5949d786f..c96d8ac05 100644 --- a/panel/src/ts/components/inputs/editor/markdown/linktooltip.ts +++ b/panel/src/ts/components/inputs/editor/markdown/linktooltip.ts @@ -64,7 +64,7 @@ class LinkTooltipView { destroy() { if (this.tooltip) { const tooltip = this.tooltip; - setTimeout(() => tooltip.remove(), 100); + window.setTimeout(() => tooltip.remove(), 100); } this.tooltip = undefined; } diff --git a/panel/src/ts/components/notification.ts b/panel/src/ts/components/notification.ts index 9386ea690..3118d3221 100644 --- a/panel/src/ts/components/notification.ts +++ b/panel/src/ts/components/notification.ts @@ -60,13 +60,13 @@ export class Notification { this.containerElement.appendChild(notification); } - let timer = setTimeout(() => this.remove(), interval); + let timer = window.setTimeout(() => this.remove(), interval); notification.addEventListener("click", () => this.remove()); notification.addEventListener("mouseenter", () => clearTimeout(timer)); - notification.addEventListener("mouseleave", () => ((timer = setTimeout(() => this.remove())), this.options.mouseleaveDelay)); + notification.addEventListener("mouseleave", () => ((timer = window.setTimeout(() => this.remove())), this.options.mouseleaveDelay)); return notification; }; @@ -84,7 +84,7 @@ export class Notification { remove() { this.notificationElement.classList.add("fadeout"); - setTimeout(() => { + window.setTimeout(() => { if (this.containerElement && this.notificationElement && this.notificationElement.parentNode) { this.containerElement.removeChild(this.notificationElement); } diff --git a/panel/src/ts/components/notifications.ts b/panel/src/ts/components/notifications.ts index e938573f0..2beea7208 100644 --- a/panel/src/ts/components/notifications.ts +++ b/panel/src/ts/components/notifications.ts @@ -6,7 +6,7 @@ export class Notifications { let delay = 0; $$("meta[name=notification]").forEach((element: HTMLMetaElement) => { - setTimeout(() => { + window.setTimeout(() => { const data = JSON.parse(element.content); const notification = new Notification(data.text, data.type, { interval: data.interval, diff --git a/panel/src/ts/components/tooltip.ts b/panel/src/ts/components/tooltip.ts index 21f684837..c26fa6a71 100644 --- a/panel/src/ts/components/tooltip.ts +++ b/panel/src/ts/components/tooltip.ts @@ -50,7 +50,7 @@ export class Tooltip { const options = this.options; const container = options.container; - this.delayTimer = setTimeout(() => { + this.delayTimer = window.setTimeout(() => { const tooltip = document.createElement("div"); tooltip.className = "tooltip"; tooltip.setAttribute("role", "tooltip"); @@ -136,7 +136,7 @@ export class Tooltip { } if (options.timeout !== null) { - this.timeoutTimer = setTimeout(() => this.remove(), options.timeout); + this.timeoutTimer = window.setTimeout(() => this.remove(), options.timeout); } if (options.removeOnMouseout) { diff --git a/panel/src/ts/components/views/backups.ts b/panel/src/ts/components/views/backups.ts index 3a16cd819..d1849065d 100644 --- a/panel/src/ts/components/views/backups.ts +++ b/panel/src/ts/components/views/backups.ts @@ -83,7 +83,7 @@ export class Backups { notification.show(); if (response.status === "success") { - setTimeout(() => { + window.setTimeout(() => { triggerDownload(response.data.uri, ($("meta[name=csrf-token]") as HTMLMetaElement).content); }, 1000); } diff --git a/panel/src/ts/components/views/dashboard.ts b/panel/src/ts/components/views/dashboard.ts index 5f5d646c5..74f2473d8 100644 --- a/panel/src/ts/components/views/dashboard.ts +++ b/panel/src/ts/components/views/dashboard.ts @@ -56,7 +56,7 @@ export class Dashboard { notification.show(); if (response.status === "success") { - setTimeout(() => { + window.setTimeout(() => { button.disabled = false; triggerDownload(response.data.uri, ($("meta[name=csrf-token]") as HTMLMetaElement).content); }, 1000); diff --git a/panel/src/ts/components/views/updates.ts b/panel/src/ts/components/views/updates.ts index be7b8eaae..c5c17946e 100644 --- a/panel/src/ts/components/views/updates.ts +++ b/panel/src/ts/components/views/updates.ts @@ -37,7 +37,7 @@ export class Updates { currentVersion.style.display = "block"; }; - setTimeout(() => { + window.setTimeout(() => { const data = { "csrf-token": ($("meta[name=csrf-token]") as HTMLMetaElement).content }; new Request( diff --git a/panel/src/ts/utils/events.ts b/panel/src/ts/utils/events.ts index 43b2c3bb5..7b9f3c310 100644 --- a/panel/src/ts/utils/events.ts +++ b/panel/src/ts/utils/events.ts @@ -11,7 +11,7 @@ export function debounce(callback: (...args: any[]) => any, delay: number, leadi if (leading && !timer) { result = callback.apply(context, args); } - timer = setTimeout(() => { + timer = window.setTimeout(() => { if (!leading) { result = callback.apply(context, args); } @@ -44,7 +44,7 @@ export function throttle(callback: (...args: any[]) => any, delay: number) { previous = now; result = callback.apply(context, args); } else if (!timer) { - timer = setTimeout(() => { + timer = window.setTimeout(() => { previous = Date.now(); result = callback.apply(context, args); timer = null;