s
s
snc
Search…
parallel
snc.parallel(array_functions(done), callback_end(data))
Run functions in parallel and then execute "callback_end". Alternative name: p.
1
snc.parallel(
2
[
3
done => {
4
setTimeout(() => {
5
console.log(`hi 3!`)
6
done(`a`)
7
}, 3000)
8
},
9
done => {
10
setTimeout(() => {
11
console.log(`hi 2!`)
12
done(`b`)
13
}, 2000)
14
},
15
done => {
16
setTimeout(() => {
17
console.log(`hi 1!`)
18
done(`c`)
19
}, 1000)
20
}
21
],
22
data => {
23
console.log(`End: ${JSON.stringify(data)}`)
24
})
Copied!
1
//Wait 1 second
2
-> hi 1! //Wait 1 second
3
-> hi 2! //Wait 1 second
4
-> hi 3!
5
-> End: ["a","b","c"]
Copied!
Copy link