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
// basic event click handler | |
event(document.getElementById("link"))("click")(function(){ | |
console.log("click!") | |
}) | |
/** | |
* Attach and Detach Handlers | |
*/ | |
// attach handler | |
var linkclick = event(document.getElementById("link"))("click")(function(){ | |
console.log("click!") | |
}) | |
// detach handler | |
linkclick() | |
/** | |
* Multiple events from one selector | |
*/ | |
var el = event(document.getElementById("link")) | |
// click handler | |
el("click")(function(){ | |
console.log("click") | |
}) | |
// mouseover handler | |
el("mouseover")(function(){ | |
console.log("mouse over!") | |
}) | |
/** | |
* Multiple handlers for same event | |
*/ | |
var onclick = event(document.getElementById("link"))("click") | |
onclick(function(){ | |
console.log("clicked!") | |
}) | |
onclick(function(){ | |
console.log("me too!") | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment