Dasbroad
Author: titchip23
Description Launch Bot Current Users

Short Description:

Dasbroad

Full Description

let f1 = (cb) => {
setTimeout(() => {
cb(null, {a: 1})
},100)
}

let f2 = (cb) => {
setTimeout(() => {
cb(null, {a: 2})
},50)
}

let f3 = (cb) => {
setTimeout(() => {
cb(null, {a: 3})
},10)
}

function parallelConsole(arr, cb) {
let result = [];
arr.forEach(func => {
func((temp, val) => {
console.log(val)
result.push(val)
if(arr.length === result.length) {
cb(result)
}
})
})
}

parallelConsole([f1, f2, f3], (res) => {
console.log(res) //[{a: 3}, {a: 2}, {a: 1}]
})

© Copyright Freesexcam 2011- 2024. All Rights Reserved.