Asynchronous parallel function execution with Node-style callbacks

JS
S
JavaScript

Example of calling 2 async functions in parallell and a last one after the first ones have finished. https://www.libhive.com/providers/npm/packages/async

1async.parallel({
2    reviewers: async.apply(asyncOps1),
3    coffeeShops: async.apply(asyncOps2),
4}, (err, results) => {
5    if (err) throw err;
6    inspectResults(results.ops1, results.ops2, (err) => {
7        if (err) throw err;
8        console.log('> models created sucessfully');
9    });
10});
11
12function asyncOps1(cb) {
13    //...
14    cb(results);
15}
16
17function asyncOps2(cb) {
18    //...
19    cb(results);
20}
21
22function inspectResults(ops1, ops2, cb) {
23    // ...
24    cb(inspectionResults);
25}

Created on 5/7/2018