Skip to content

Instantly share code, notes, and snippets.

@c0depanda
Last active January 18, 2018 22:59
Show Gist options
  • Save c0depanda/c5d10cbb21be4ac80794ce6a1a1f0262 to your computer and use it in GitHub Desktop.
Save c0depanda/c5d10cbb21be4ac80794ce6a1a1f0262 to your computer and use it in GitHub Desktop.
// Create timeout ( run function after 1s )
let start = (e) => {
// Make sure the event trigger isn't a click event
if (e.type === 'click' && e.button !== 0) {
return;
}
// Make sure we don't currently have a setTimeout running
// before starting another
if (pressTimer === null) {
pressTimer = setTimeout(() => {
// Execute soemthing !!!
}, 1000)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment