Skip to content

Commit

Permalink
register for the hash change event instead of polling
Browse files Browse the repository at this point in the history
  • Loading branch information
etienneCharignon committed Dec 5, 2018
1 parent 2ede693 commit 52abdcf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions public/paysagerenderer/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var Paysage = window.Paysage || {};
installResizeHandler();

var urlHash = '';
setInterval(function () {
window.addEventListener('hashchange', function () {
var newHash = window.location.hash;
if (urlHash === newHash) {
return;
Expand All @@ -55,7 +55,7 @@ var Paysage = window.Paysage || {};

Paysage.readIdsFromUrlHash(urlHash);
Paysage.filterCodeObjects(Object.keys(canvas), show, hide);
}, 200);
});
};

function show (id) {
Expand Down

0 comments on commit 52abdcf

Please sign in to comment.