Skip to content

Instantly share code, notes, and snippets.

@houoop
Created April 27, 2013 09:41
Show Gist options
  • Save houoop/5472524 to your computer and use it in GitHub Desktop.
Save houoop/5472524 to your computer and use it in GitHub Desktop.
js event bind
bind: window.dispatchEvent ? function(el, type, fn, phase) {
el.addEventListener(type, fn, !!phase);
return fn;
} : function(el, type, fn) {
el.attachEvent && el.attachEvent("on" + type, fn);
return fn;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment