Skip to content

Commit

Permalink
no window var
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Mar 5, 2025
1 parent 31835f4 commit 3bc3cd8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 3 additions & 2 deletions web_src/js/features/repo-view-file-tree-sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
});
}
Expand Down
1 change: 0 additions & 1 deletion web_src/js/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,5 @@ interface Window {
turnstile: any,
hcaptcha: any,
codeEditors: any[],
popstateListenerForViewFilePageAdded: boolean,
updateCloneStates: () => void,
}

0 comments on commit 3bc3cd8

Please sign in to comment.