Sunday 21 May 2017

can I add a parameter to my promise callback?

I have a promise call back that needs some external data. how can I do that? myDataINeed in this code is always null;

 var promActions = [];
 for(var k in loop){
   promActions.push(externalCall(loop[k]));
 }
 var promResults = Promise.all(promActions);
 let myDataINeed = myDataVariable;
 promResults.then(function(responseArray, myDataINeed){
    ....do stuff with responseArray and myDataINeed
 });



via spartikus

No comments:

Post a Comment