-
-
Save nuno/14ff93c46a53d83a7579 to your computer and use it in GitHub Desktop.
Snippet from Blain Hamon on how to prevent Titanium from queing up multiple tap events
This file contains hidden or 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
function handleOnce(funct) { | |
var flag = false; | |
return function(e) { | |
if (flag) return; | |
flag = true; | |
setTimeout(function() { | |
flag = false; | |
}, 0); | |
funct(e); | |
}; | |
} | |
// Usage is done as: | |
win.addEventListener('foo', handleOnce( | |
function(e){ | |
alert('I dont queue'); | |
} | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment