no window var

This commit is contained in:
wxiaoguang 2025-03-05 17:04:28 +08:00
parent 31835f4638
commit 3bc3cd8ab5
2 changed files with 3 additions and 3 deletions

View File

@ -57,6 +57,7 @@ function reloadContentScript(sidebarEl: HTMLElement, contentEl: Element) {
}
export function initViewFileTreeSidebar() {
let popstateListenerForViewFilePageAdded = false;
registerGlobalInitFunc('initViewFileTreeSidebar', async (el: HTMLElement) => {
el.querySelector('.hide-tree-sidebar-button').addEventListener('click', () => {
toggleSidebar(el, false);
@ -84,12 +85,12 @@ export function initViewFileTreeSidebar() {
}});
fileTreeView.mount(fileTree);
if (!window.popstateListenerForViewFilePageAdded) {
if (!popstateListenerForViewFilePageAdded) {
window.addEventListener('popstate', () => {
selectedItem.value = getSelectedPath(refString);
loadContent(el);
});
window.popstateListenerForViewFilePageAdded = true;
popstateListenerForViewFilePageAdded = true;
}
});
}

View File

@ -74,6 +74,5 @@ interface Window {
turnstile: any,
hcaptcha: any,
codeEditors: any[],
popstateListenerForViewFilePageAdded: boolean,
updateCloneStates: () => void,
}