mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix page reload on return
`popstate` event cannot be captured, but we need to process it before `page` node module.
This commit is contained in:
parent
a71ed46afb
commit
fd0532f193
1 changed files with 13 additions and 8 deletions
|
@ -34,15 +34,20 @@ class AppRouter {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
// WebKit fires a popstate event on document load
|
// WebKit fires a popstate event on document load
|
||||||
// Skip it using timeout
|
// Skip it using boolean
|
||||||
// For Tizen 2.x
|
// For Tizen 2.x
|
||||||
// https://stackoverflow.com/a/12214354
|
// See `page` node module
|
||||||
window.addEventListener('load', () => {
|
let loaded = document.readyState === 'complete';
|
||||||
setTimeout(() => {
|
if (!loaded) {
|
||||||
window.addEventListener('popstate', () => {
|
window.addEventListener('load', () => {
|
||||||
this.popstateOccurred = true;
|
setTimeout(() => {
|
||||||
});
|
loaded = true;
|
||||||
}, 0);
|
}, 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
window.addEventListener('popstate', () => {
|
||||||
|
if (!loaded) return;
|
||||||
|
this.popstateOccurred = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener('viewshow', () => this.onViewShow());
|
document.addEventListener('viewshow', () => this.onViewShow());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue