Skip to content

Commit

Permalink
js: unload replaced with pagehide [Closes #576]
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Mar 31, 2024
1 parent 42d88b2 commit 36053c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Tracy/Bar/assets/bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class Panel
doc.title = this.elem.querySelector('h1').textContent;
}

win.addEventListener('beforeunload', () => {
win.addEventListener('pagehide', () => {
this.toPeek();
win.close(); // forces closing, can be invoked by F5
});
Expand Down Expand Up @@ -469,7 +469,7 @@ class Debug
size = newSize;
});

window.addEventListener('unload', () => {
window.addEventListener('pagehide', () => {
for (let id in Debug.panels) {
Debug.panels[id].savePosition();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Tracy/assets/toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Toggle
});
}

window.addEventListener('unload', () => {
window.addEventListener('pagehide', () => {
toggles = saved.map((el) => {
let item = {path: [], text: el.textContent, expand: !el.classList.contains('tracy-collapsed')};
do {
Expand Down

0 comments on commit 36053c1

Please sign in to comment.