I am using the async module to execute parallel tasks. Basically, I have two different files, dashboard.js and Run.js.
Dashboard.js
module.exports = {
func1 : function(){
console.log(“Funtion one”);
},
func2 : function(){
console.log(“Funtion two”);
}
}
Run.js
var dashboard = require(‘dashboard.js’);
var async = require('async');
async.parallel([dashboard.func1, dashboard.func2],function(err){
if(err)throws err;
console.log(“ All function executed”);
});
I was expecting func1 and func2 to execute in parallel, but it is throwing the below error.
TypeError: task is not a function
at C:\Users\..\java\realtime-preview\node_modules\async\lib\async.js:718:13
at async.forEachOf.async.eachOf (C:\Users\..\java\realtime-preview\node_modules\async\lib\async.js:233:13)
at _parallel (C:\Users\\java\realtime-preview\node_modules\async\lib\async.js:717:9)
why can I not use dashboard.func1, dashboard.func2 even if dashboard.func1 is a function?