Skip to content

Instantly share code, notes, and snippets.

@FokkeZB
Created April 16, 2013 07:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save FokkeZB/5394118 to your computer and use it in GitHub Desktop.
Save FokkeZB/5394118 to your computer and use it in GitHub Desktop.
Snippet from Blain Hamon on how to prevent Titanium from queing up multiple tap events
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