Skip to content

Instantly share code, notes, and snippets.

@jhartikainen
Created September 5, 2016 23:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhartikainen/a0f3f598d3ba6e76c344427bfaca5e81 to your computer and use it in GitHub Desktop.
Save jhartikainen/a0f3f598d3ba6e76c344427bfaca5e81 to your computer and use it in GitHub Desktop.
Chained timeouts
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