fix some bugs.

This commit is contained in:
Rintim 2023-09-10 16:04:59 +08:00
parent 4594fb82cb
commit 828b7c0ab2
1 changed files with 7 additions and 7 deletions

View File

@ -69,7 +69,7 @@
is:{ is:{
coroutine:item=>(typeof item=="function"||gnc.is.generator(item))&&item.name=="genCoroutine", coroutine:item=>(typeof item=="function"||gnc.is.generator(item))&&item.name=="genCoroutine",
generatorFunc:item=>item instanceof GeneratorFunction, generatorFunc:item=>item instanceof GeneratorFunction,
generator:item=>item.constructor.constructor==GeneratorFunction generator:item=>(typeof item=="object")&&("constructor" in item)&&item.constructor&&("constructor" in item.constructor)&&item.constructor.constructor===GeneratorFunction
} }
}; };
const _status={ const _status={
@ -8304,8 +8304,8 @@
const loadPack=()=>{ const loadPack=()=>{
if (Array.isArray(lib.onprepare)&&lib.onprepare.length){ if (Array.isArray(lib.onprepare)&&lib.onprepare.length){
_status.onprepare=Object.freeze(lib.onprepare.map(fn=>{ _status.onprepare=Object.freeze(lib.onprepare.map(fn=>{
const result=fn(); if(typeof fn!="function") return;
return gnc.is.generatorFunc(fn)?gnc.await(result):result; return gnc.await(fn());
})); }));
} }
let toLoad=lib.config.all.cards.length+lib.config.all.characters.length+1; let toLoad=lib.config.all.cards.length+lib.config.all.characters.length+1;
@ -9096,8 +9096,8 @@
delete lib.onload; delete lib.onload;
while(Array.isArray(libOnload)&&libOnload.length){ while(Array.isArray(libOnload)&&libOnload.length){
const fun=libOnload.shift(); const fun=libOnload.shift();
const result=fun(); if(typeof fun!="function") continue;
yield gnc.is.generatorFunc(fun)?gnc.await(result):result; yield gnc.await(fun());
} }
ui.updated(); ui.updated();
game.documentZoom=game.deviceZoom; game.documentZoom=game.deviceZoom;
@ -9870,8 +9870,8 @@
delete lib.onload2; delete lib.onload2;
while(Array.isArray(libOnload2)&&libOnload2.length){ while(Array.isArray(libOnload2)&&libOnload2.length){
const fun=libOnload2.shift(); const fun=libOnload2.shift();
const result=fun(); if(typeof fun!="function") continue;
yield gnc.is.generatorFunc(fun)?gnc.await(result):result; yield gnc.await(fun());
} }
}), }),
startOnline:function(){ startOnline:function(){