mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-21 03:44:05 -06:00
refactor: remove unnecessary type assertions for window.addCleanup
This commit is contained in:
parent
1f6cbcbb71
commit
4d30363545
@ -14,13 +14,12 @@ export function registerEscapeHandler(outsideContainer: HTMLElement | null, cb:
|
|||||||
}
|
}
|
||||||
|
|
||||||
outsideContainer?.addEventListener("click", click)
|
outsideContainer?.addEventListener("click", click)
|
||||||
// Use type assertion to avoid TypeScript error when checking individual files
|
if (typeof window.addCleanup === "function") {
|
||||||
if (typeof (window as any).addCleanup === "function") {
|
window.addCleanup(() => outsideContainer?.removeEventListener("click", click))
|
||||||
;(window as any).addCleanup(() => outsideContainer?.removeEventListener("click", click))
|
|
||||||
}
|
}
|
||||||
document.addEventListener("keydown", esc)
|
document.addEventListener("keydown", esc)
|
||||||
if (typeof (window as any).addCleanup === "function") {
|
if (typeof window.addCleanup === "function") {
|
||||||
;(window as any).addCleanup(() => document.removeEventListener("keydown", esc))
|
window.addCleanup(() => document.removeEventListener("keydown", esc))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user