send a request to the background during development. After a successful return, the page is refreshed and the pop-up prompt is successful. The
pop-up window often shows only one line and it ends.
at first
initPage(); //
showInfo(""); //
then try to use Promise Synchronize
new Promise(function(resolve){
init.initPage();
window.onload = function(){ //
resolve();
}
}).then(function(){
showInfo("");
})
but all failed.
the actual code is developed using require.js sub-module
//
function saveDevicesCallback(result){
if(result.result == 0){
//
new Promise(function(resolve){
require(["event/device"],function(init){
init.initPage();
});
resolve();
}).then(function(){
showInfo("");
})
}else{
showError("");
}
}
want to see the page refresh first and then prompt the message box