From 31a7b69799bde01aabe0e818616bf3387b917c8b Mon Sep 17 00:00:00 2001 From: Rintim Date: Thu, 14 Sep 2023 00:35:18 +0800 Subject: [PATCH] [2023/09/14: Inchar] wait import. Use `yield` as `await` to wait `game.import` done. --- game/game.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/game/game.js b/game/game.js index dcebda4a5..3eb4604cf 100644 --- a/game/game.js +++ b/game/game.js @@ -33694,12 +33694,10 @@ }, importExtension:gnc.async(function*(data,finishLoad,exportext,pkg){ //by 来瓶可乐加冰 - if(!window.JSZip){ - lib.init.js(lib.assetURL+'game','jszip',function(){ - game.importExtension(data,finishLoad,exportext,pkg); - }); - } - else if(get.objtype(data)=='object'){ + if(!window.JSZip) + yield new Promise((resolve,reject)=>lib.init.js(`${lib.assetURL}game`,"jszip",resolve,reject)); + + if(get.objtype(data)=='object'){ //导出 var zip=new JSZip(); var filelist=[]; @@ -33807,6 +33805,8 @@ if(str===""||undefined) throw('你导入的不是扩展!请选择正确的文件'); _status.importingExtension=true; eval(str); + yield Promise.allSettled(_status.extensionLoading); + delete _status.extensionLoading; _status.importingExtension=false; if(!game.importedPack) throw('err'); var extname=game.importedPack.name;