Frontend: Move "popstate" handler to common/navigation.js #2597 #2648

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2022-09-14 21:06:27 +02:00
parent 9f81151475
commit a1edb88b94
3 changed files with 11 additions and 10 deletions

View file

@ -25,6 +25,7 @@ Additional information can be found in our Developer Guide:
import "core-js/stable";
import "regenerator-runtime/runtime";
import "common/navigation";
import Api from "common/api";
import Notify from "common/notify";
import Scrollbar from "common/scrollbar";
@ -112,16 +113,6 @@ Vue.use(VueFullscreen);
Vue.use(VueFilters);
Vue.use(Components);
Vue.use(Dialogs);
window.backwardsNavigationDetected = false;
window.addEventListener("popstate", () => {
window.backwardsNavigationDetected = true;
// give components time to react to backwardsNavigationDetected in `created` or '$route'-watcher
setTimeout(() => {
window.backwardsNavigationDetected = false;
});
});
Vue.use(Router);
// Configure client-side routing

View file

@ -0,0 +1,9 @@
window.backwardsNavigationDetected = false;
window.addEventListener("popstate", () => {
window.backwardsNavigationDetected = true;
// give components time to react to backwardsNavigationDetected in `created` or '$route'-watcher
setTimeout(() => {
window.backwardsNavigationDetected = false;
});
});

View file

@ -25,6 +25,7 @@ Additional information can be found in our Developer Guide:
import "core-js/stable";
import "regenerator-runtime/runtime";
import "common/navigation";
import Api from "common/api";
import Notify from "common/notify";
import Scrollbar from "common/scrollbar";