Skip to content

Instantly share code, notes, and snippets.

@dnasca
Created July 29, 2015 05:59
Show Gist options
  • Select an option

  • Save dnasca/822ba09485be4f995d73 to your computer and use it in GitHub Desktop.

Select an option

Save dnasca/822ba09485be4f995d73 to your computer and use it in GitHub Desktop.
the asynchronous callback -- the most absolute basic example using the setTimeout and setInterval functions on the client
whenDone = function () {
console.log ("done")
};
doWork = function(callback) {
//do some work
setTimeout(callback, 3000); //put the call back on the event loop by 3 seconds (during this time, other work is being done)
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment