Created
July 29, 2015 05:59
-
-
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
This file contains hidden or 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
| 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