Skip to content

Instantly share code, notes, and snippets.

@jamiecollinson
Created March 15, 2014 14:25
Show Gist options
  • Save jamiecollinson/9568102 to your computer and use it in GitHub Desktop.
Save jamiecollinson/9568102 to your computer and use it in GitHub Desktop.
// create a one-time event
function onetime(node, type, callback) {
// create event
node.addEventListener(type, function(e) {
// remove event
e.target.removeEventListener(e.type, arguments.callee);
// call handler
return callback(e);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment