Created
September 5, 2016 23:50
-
-
Save jhartikainen/a0f3f598d3ba6e76c344427bfaca5e81 to your computer and use it in GitHub Desktop.
Chained timeouts
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
var moves = [].. | |
function makeMove() { | |
var m = moves.shift(); | |
if(!m) { | |
return everythingDone(); | |
} | |
setTimeout(function() { | |
activateButton(m); | |
setTimeout(function() { | |
deactivateButton(m); | |
makeMove(); | |
}, 250); | |
}, 1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment