Created
April 21, 2017 18:07
-
-
Save kunle/522daf95ef420c6cfe9c61c843296e1f to your computer and use it in GitHub Desktop.
JS Bin Async parallel loop // source https://jsbin.com/tepufik
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="Async parallel loop"> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script src="https://rawgit.com/caolan/async/v1.5.2/dist/async.min.js"></script> | |
<script id="jsbin-javascript"> | |
let x = [100, 20, 40, 50, 60]; | |
let funcs = x.map((e)=> (cb) => { setTimeout(()=>{console.log(`done ${e}`);cb(null,e+' done');}, e*10);}); | |
async.parallel(funcs, (err, results) => { console.log('results', results);}); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">let x = [100, 20, 40, 50, 60]; | |
let funcs = x.map((e)=> (cb) => { setTimeout(()=>{console.log(`done ${e}`);cb(null,e+' done');}, e*10);}); | |
async.parallel(funcs, (err, results) => { console.log('results', results);});</script></body> | |
</html> |
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
let x = [100, 20, 40, 50, 60]; | |
let funcs = x.map((e)=> (cb) => { setTimeout(()=>{console.log(`done ${e}`);cb(null,e+' done');}, e*10);}); | |
async.parallel(funcs, (err, results) => { console.log('results', results);}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment