Created
August 16, 2013 16:31
-
-
Save tomgullo/6251403 to your computer and use it in GitHub Desktop.
async_js_example
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
| $(document).ready(function() { | |
| async.waterfall([ | |
| function(next){ | |
| setTimeout(function() { | |
| console.log('in this tImeout'); | |
| next(null, 'one', 'two'); | |
| }, | |
| 2000); | |
| }, | |
| function(arg1, arg2, next){ | |
| console.log('arguments ' + arg1); | |
| setTimeout(function() { | |
| console.log('in other tImeout'); | |
| next(null, 'three'); | |
| //next('whooops', 'error'); | |
| }, | |
| 2000); | |
| }, | |
| function(arg1, next){ | |
| next(null, arg1); | |
| } | |
| ], function (err, result) { | |
| console.log('result ' + result); | |
| console.log('error ' + err); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment