Skip to content

Instantly share code, notes, and snippets.

@olivierrr
Created December 22, 2014 01:34
Show Gist options
  • Save olivierrr/6d6eb62eedfe614dc5d9 to your computer and use it in GitHub Desktop.
Save olivierrr/6d6eb62eedfe614dc5d9 to your computer and use it in GitHub Desktop.
requirebin sketch
var timer = null
elem.addEventListener('click', function(){
if(timer) {
clearTimeout(timer)
doStuff()
}
else timer = setTimeout(doStuff, 3000)
})
function doStuff(){ console.log('111') }
undefined;var timer=null;elem.addEventListener("click",function(){if(timer){clearTimeout(timer);doStuff()}else timer=setTimeout(doStuff,3e3)});function doStuff(){console.log("111")}
{
"name": "requirebin-sketch",
"version": "1.0.0"
}
<style type='text/css'>html, body { margin: 0; padding: 0; border: 0; }
body, html { height: 100%; width: 100%; }</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment