Created
April 27, 2013 09:41
-
-
Save houoop/5472524 to your computer and use it in GitHub Desktop.
js event bind
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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