Permalink
Browse files

revert poll interval of hash changes in oui.anchor

  • Loading branch information...
1 parent 97c24a6 commit a9f5e57b3e033593dc704c4c63a1104ad5177224 @rsms committed Apr 20, 2010
Showing with 9 additions and 9 deletions.
  1. +9 −9 client/lib/oui/anchor.js
View
@@ -196,15 +196,15 @@ function _init() {
onHashChange();
}
});
- } //else {
- setInterval(function(){
- if (exports._prevhash !== document.location.hash){
- exports._prevhash = document.location.hash;
- onHashChange();
- }
- }, 500);
- //}
- //if (document.location.hash === '' || document.location.hash != exports._prevhash)
+ }
+ // even though onhashchange exists in modern browsers, it's a bit buggy in some,
+ // so always poll (however at a lower rate in that case) the state.
+ setInterval(function(){
+ if (exports._prevhash !== document.location.hash){
+ exports._prevhash = document.location.hash;
+ onHashChange();
+ }
+ }, ("onhashchange" in window) ? 500 : 100);
onHashChange();
return true;
}

0 comments on commit a9f5e57

Please sign in to comment.