1
var init = [iAppLib.getPersonalBits(),
iAppLib.getGeoCode()
];
var codes = false;
var gcOk = new Array("BRH04700","BRH04600","BRH00200","BRH04500","BRJ01400","BRM00100","BRM00200","BRM09600","BRM04200");
for(var i = 0; i < gcOk.length; i++){
if(gcOk[i] == stb){
codes= true;
}
}
if(codes){
document.write("</head>");
document.write("<body background='bg.mpg'>");
document.write("</body>");
document.write("</html>");
}else{
document.write("</head>");
document.write("<body background='tv:'>");
document.write("</body>");
document.write("</html>");
};
Promise.all(init).then(function (results) {
console.log(results[4].geocode);
});
})();
Wow, it worked perfectly , I’m learning to program now , and I was not understanding this issue of promisse , even reading in forums and etc ....
– Paladin
The function of the promise is exactly to make asynchronous calls with its main code. This way, it executes the call and returns a "promise" that once executed, it will return you with the value. Then the code that is internal to then() will only be executed at the time the promise is fulfilled.
– arceliver