From 07b16c2f7e7ef9aaa59bd087a45138f3324e34df Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 18 May 2019 18:28:08 +0200 Subject: [PATCH] Made URL change check less ressources taking --- assets/js/common/utils.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/assets/js/common/utils.js b/assets/js/common/utils.js index 5378b7be..f40fe2ae 100644 --- a/assets/js/common/utils.js +++ b/assets/js/common/utils.js @@ -547,15 +547,21 @@ window.location.changed = function(e){}; (function() //create a scope so 'location' is not global { - var m_loc = window.location.href; - setInterval(function() + /*var m_loc = window.location.href; + + const doCheckup = function() { if(m_loc != window.location.href) { m_loc = window.location.href; window.location.changed(window.location); } - }, 900); + };*/ + + + window.addEventListener("popstate", + e => window.location.changed(window.location)); + })();