determine name && add lib.onload2

This commit is contained in:
Rintim 2023-09-05 00:08:23 +08:00
parent bf746cf07d
commit f6cf169e53
1 changed files with 11 additions and 1 deletions

View File

@ -55,7 +55,7 @@
}) })
} }
function genAsync(fn){ function genAsync(fn){
return function AsyncSimulator(){ return function genCoroutine(){
var self=this,args=arguments; var self=this,args=arguments;
return new Promise((resolve,reject)=>{ return new Promise((resolve,reject)=>{
var gen=fn.apply(self,args); var gen=fn.apply(self,args);
@ -150,6 +150,7 @@
card:{}, card:{},
}, },
onload:[], onload:[],
onload2:[],
arenaReady:[], arenaReady:[],
onfree:[], onfree:[],
inpile:[], inpile:[],
@ -7152,6 +7153,8 @@
'无名杀 - 录像 - '+_status.videoToSave.name[0]+' - '+_status.videoToSave.name[1]); '无名杀 - 录像 - '+_status.videoToSave.name[0]+' - '+_status.videoToSave.name[1]);
} }
}, },
genAsync:genAsync,
genAwait:genAwait,
init:{ init:{
init:function(){ init:function(){
if(typeof __dirname==='string'&&__dirname.length){ if(typeof __dirname==='string'&&__dirname.length){
@ -9615,6 +9618,13 @@
} }
localStorage.removeItem(lib.configprefix+'directstart'); localStorage.removeItem(lib.configprefix+'directstart');
delete lib.init.init; delete lib.init.init;
const libOnload2=lib.onload2;
delete lib.onload2;
while(Array.isArray(libOnload2)&&libOnload2.length){
const fun=libOnload2.shift();
const result=fun();
yield (fun instanceof GeneratorFunction)?genAwait(result):result;
}
}), }),
startOnline:function(){ startOnline:function(){
'step 0' 'step 0'