Skip to content

Commit 32346a0

Browse files
committed
no window var
1 parent 31835f4 commit 32346a0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

web_src/js/features/repo-view-file-tree-sidebar.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ function reloadContentScript(sidebarEl: HTMLElement, contentEl: Element) {
5757
}
5858

5959
export function initViewFileTreeSidebar() {
60+
let popstateListenerForViewFilePageAdded = false;
6061
registerGlobalInitFunc('initViewFileTreeSidebar', async (el: HTMLElement) => {
6162
el.querySelector('.hide-tree-sidebar-button').addEventListener('click', () => {
6263
toggleSidebar(el, false);
@@ -84,12 +85,12 @@ export function initViewFileTreeSidebar() {
8485
}});
8586
fileTreeView.mount(fileTree);
8687

87-
if (!window.popstateListenerForViewFilePageAdded) {
88+
if (!popstateListenerForViewFilePageAdded) {
8889
window.addEventListener('popstate', () => {
8990
selectedItem.value = getSelectedPath(refString);
9091
loadContent(el);
9192
});
92-
window.popstateListenerForViewFilePageAdded = true;
93+
popstateListenerForViewFilePageAdded = true;
9394
}
9495
});
9596
}

0 commit comments

Comments
 (0)