can
Version:
MIT-licensed, client-side, JavaScript framework that makes building rich web applications easy.
18 lines (17 loc) • 512 B
JavaScript
steal('can/util/can.js', function (can) {
// This is a workaround for libraries that don't natively listen to the window hashchange event
(function () {
var addEvent = function (el, ev, fn) {
if (el.addEventListener) {
el.addEventListener(ev, fn, false);
} else if (el.attachEvent) {
el.attachEvent('on' + ev, fn);
} else {
el['on' + ev] = fn;
}
}, onHashchange = function () {
can.trigger(window, 'hashchange');
};
addEvent(window, 'hashchange', onHashchange);
}());
});