polyfill-service
Version:
A polyfill combinator
19 lines (13 loc) • 417 B
JavaScript
(function (global) {
var hash = global.location.hash;
function poll () {
if (hash !== global.location.hash) {
hash = global.location.hash;
global.dispatchEvent(new Event('hashchange'));
}
setTimeout(poll, 500);
};
// Make sure a check for 'onhashchange' in window will pass (note: setting to undefined IE<9 causes 'Not implemented' error)
global.onhashchange = function() {};
poll();
})(this);