Thursday, 11 May 2017

How do I export a node.js module which is inside the Promise.all (somefunction) . then (function (){})

I have a function like this

//index1.js

var ted = ['arr','xyz','wer'].map(function(name){

    return new Promise(function(resolve,reject){

// my async function 
resolve();

}// end of ted function 

Now I have 
Promise.all(ted).then(function(){ 
/// i want to export something from this place that triggers a different js file
})

Now I have another js file // index2.js

var getstatus = require('./index1');

console.log(getstatus) // I get this empty . 

When I run index2.js . I get getstatus as empty. How do I get this working? I'm using Node.js to do it. Please help



via karthik006

No comments:

Post a Comment