s
s
snc
Search…
foreverParallel
snc.foreverParallel(limit, callback(counter, done), callback_end(data))
Forever loop with parallel limit. Alternative name: fp.
1
snc.fp(2, (counter, done, end) => {
2
console.log(counter)
3
if (counter < 6 ) {
4
setTimeout(() => {
5
done()
6
}, 3000)
7
} else end('bye!')
8
},
9
res => {
10
console.log(`END: ${res}`)
11
})
Copied!
1
-> 1
2
-> 2
3
-> 3 // Wait 3 seconds
4
-> 4 // Wait 3 seconds
5
-> 5 // Wait 6 seconds
6
-> 6 // Wait 6 seconds
7
-> 7 // Wait 9 seconds
8
-> END: bye bye! // Wait 9 seconds
Copied!
Copy link