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

View File

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