Last active
January 18, 2018 22:59
-
-
Save c0depanda/c5d10cbb21be4ac80794ce6a1a1f0262 to your computer and use it in GitHub Desktop.
This file contains 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
// 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