add import wait.
This commit is contained in:
parent
4777678bb7
commit
ca39862a81
18
game/game.js
18
game/game.js
|
@ -8336,15 +8336,23 @@
|
||||||
if(!arrayLengths.length) return previousValue+1;
|
if(!arrayLengths.length) return previousValue+1;
|
||||||
return previousValue+Math.min(...arrayLengths);
|
return previousValue+Math.min(...arrayLengths);
|
||||||
},0);
|
},0);
|
||||||
const packLoaded=()=>{
|
const packLoaded=gnc.async(function*(){
|
||||||
toLoad--;
|
toLoad--;
|
||||||
if(toLoad) return;
|
if(toLoad) return;
|
||||||
|
if(_status.importing){
|
||||||
|
let promises=lib.creation.a;
|
||||||
|
for(const type in _status.importing){
|
||||||
|
promises.addArray(_status.importing[type])
|
||||||
|
}
|
||||||
|
yield Promise.allSettled(promises);
|
||||||
|
delete _status.importing;
|
||||||
|
}
|
||||||
if(_status.windowLoaded){
|
if(_status.windowLoaded){
|
||||||
delete _status.windowLoaded;
|
delete _status.windowLoaded;
|
||||||
lib.init.onload();
|
lib.init.onload();
|
||||||
}
|
}
|
||||||
else _status.packLoaded=true;
|
else _status.packLoaded=true;
|
||||||
};
|
});
|
||||||
if(localStorage.getItem(`${lib.configprefix}playback`)){
|
if(localStorage.getItem(`${lib.configprefix}playback`)){
|
||||||
toLoad++;
|
toLoad++;
|
||||||
lib.init.js(`${lib.assetURL}mode`,lib.config.mode,packLoaded,packLoaded);
|
lib.init.js(`${lib.assetURL}mode`,lib.config.mode,packLoaded,packLoaded);
|
||||||
|
@ -33493,12 +33501,16 @@
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(!lib.imported[type])lib.imported[type]={};
|
if(!lib.imported[type])lib.imported[type]={};
|
||||||
return gnc.await(content(lib,game,ui,get,ai,_status)).then(content2=>{
|
if(typeof _status.importing=="undefined")_status.importing={};
|
||||||
|
if(!_status.importing[type])_status.importing[type]=[];
|
||||||
|
const promise=gnc.await(content(lib,game,ui,get,ai,_status)).then(content2=>{
|
||||||
if(content2.name){
|
if(content2.name){
|
||||||
lib.imported[type][content2.name]=content2;
|
lib.imported[type][content2.name]=content2;
|
||||||
delete content2.name;
|
delete content2.name;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
_status.importing[type].add(promise);
|
||||||
|
return promise;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
loadExtension:gnc.async(function*(obj){
|
loadExtension:gnc.async(function*(obj){
|
||||||
|
|
Loading…
Reference in New Issue