Created
April 5, 2015 11:45
-
-
Save antonlvovych/52f9c917d5e3da52f662 to your computer and use it in GitHub Desktop.
Catches user once at any of defined on node events
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
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