I'm new to this asynchronous stuff. I learned how to use call back, but now I need to use two functions (Asynchronously) and only after they will finish I want to call my callback:
function bigFunction(data, callback) {
//only after they will finish ||
func1(); // <================||
func2(); // <================||
//call callback
callback();
}
Real code:
function getStarsStatus(star, callback) {
require('./Bezeq').GetStarStatus(star, function(status) {
statuses['Bezeq'] = status;
});
require('./Hot').GetStarStatus(star, function(status){
statuses['Hot'] = status[0][0]['סטטוס'];
});
}
Probably there is a very simple solution that I just don't know.