Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// 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