[2023/09/14: Inchar] wait import.

Use `yield` as `await` to wait `game.import` done.
This commit is contained in:
Rintim 2023-09-14 00:35:18 +08:00
parent 0eec9bcb51
commit 31a7b69799
1 changed files with 6 additions and 6 deletions

View File

@ -33694,12 +33694,10 @@
}, },
importExtension:gnc.async(function*(data,finishLoad,exportext,pkg){ importExtension:gnc.async(function*(data,finishLoad,exportext,pkg){
//by 来瓶可乐加冰 //by 来瓶可乐加冰
if(!window.JSZip){ if(!window.JSZip)
lib.init.js(lib.assetURL+'game','jszip',function(){ yield new Promise((resolve,reject)=>lib.init.js(`${lib.assetURL}game`,"jszip",resolve,reject));
game.importExtension(data,finishLoad,exportext,pkg);
}); if(get.objtype(data)=='object'){
}
else if(get.objtype(data)=='object'){
//导出 //导出
var zip=new JSZip(); var zip=new JSZip();
var filelist=[]; var filelist=[];
@ -33807,6 +33805,8 @@
if(str===""||undefined) throw('你导入的不是扩展!请选择正确的文件'); if(str===""||undefined) throw('你导入的不是扩展!请选择正确的文件');
_status.importingExtension=true; _status.importingExtension=true;
eval(str); eval(str);
yield Promise.allSettled(_status.extensionLoading);
delete _status.extensionLoading;
_status.importingExtension=false; _status.importingExtension=false;
if(!game.importedPack) throw('err'); if(!game.importedPack) throw('err');
var extname=game.importedPack.name; var extname=game.importedPack.name;