s
s
snc
Search…
⌃K

parallel

snc.parallel(array_functions(done), callback_end(data))
Run functions in parallel and then execute "callback_end". Alternative name: p.
snc.parallel(
[
done => {
setTimeout(() => {
console.log(`hi 3!`)
done(`a`)
}, 3000)
},
done => {
setTimeout(() => {
console.log(`hi 2!`)
done(`b`)
}, 2000)
},
done => {
setTimeout(() => {
console.log(`hi 1!`)
done(`c`)
}, 1000)
}
],
data => {
console.log(`End: ${JSON.stringify(data)}`)
})
//Wait 1 second
-> hi 1! //Wait 1 second
-> hi 2! //Wait 1 second
-> hi 3!
-> End: ["a","b","c"]