Created
October 17, 2019 06:58
-
-
Save eladmeidar/6817e78a8bfb9b0933676278e787b811 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
let isRunning = false | |
const foo = function() { | |
isRunning = true | |
console.log('called') | |
isRunning = false | |
} | |
const events = ['click', 'mousedown'] | |
let func = function(eventsArr, cb) { | |
eventsArr.forEach(eventName => { | |
document.addEventListener(eventname, (e) => { | |
if (!isRunning) { | |
cb() | |
} | |
}) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment