Skip to content

Instantly share code, notes, and snippets.

@antonlvovych
Created April 5, 2015 11:45
Show Gist options
  • Save antonlvovych/52f9c917d5e3da52f662 to your computer and use it in GitHub Desktop.
Save antonlvovych/52f9c917d5e3da52f662 to your computer and use it in GitHub Desktop.
Catches user once at any of defined on node events
var userCatched = 0;
var handler = function (e) {
if (!userCatched) {
userCatched = !0;
console.log('You\'re catched!');
} else {
document.removeEventListener(e.type, arguments.callee);
}
}
document.addEventListener('touchstart', handler);
document.addEventListener('click', handler);
document.addEventListener('scroll', handler);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment