remove comment && fix format.

This commit is contained in:
Rintim 2023-09-17 02:55:31 +08:00
parent f8b7941a16
commit 1b01e5b08b
1 changed files with 2 additions and 43 deletions

View File

@ -63,45 +63,8 @@
} }
return new Promise(callback); return new Promise(callback);
}:(()=>{throw new TypeError("gnc.of needs a GeneratorFunction.")})(), }:(()=>{throw new TypeError("gnc.of needs a GeneratorFunction.")})(),
/*
await:gen=>new Promise((resolve,reject)=>{
let result=gen;
let nexts=resolve;
let throws=reject;
if(gnc.is.coroutine(gen)||(gnc.is.generator(gen)&&!gen.nocoroutine)) {
if(!gen.status)gen.status="next";
if(!gen.state)gen.state=undefined;
try{
result=gen[result.status](result.state);
}catch(error){
reject(error);
return;
}
if(!result.done){
nexts=(item)=>{
gen.state=item;
gen.status="next";
gnc.await(gen).then(resolve,reject);
}
throws=(err)=>{
gen.state=err;
gen.status="throw";
gnc.await(gen).then(resolve,reject);
}
}
result=result.value;
}
Promise.resolve(result).then(nexts,throws);
}),
*/
/*
escape:gen=>{
gen.nocoroutine=true;
return gen;
},
*/
is:{ is:{
coroutine:item=>(typeof item=="function"||gnc.is.generator(item))&&item.name=="genCoroutine", coroutine:item=>typeof item=="function"&&item.name=="genCoroutine",
generatorFunc:item=>item instanceof GeneratorFunction, generatorFunc:item=>item instanceof GeneratorFunction,
generator:item=>(typeof item=="object")&&("constructor" in item)&&item.constructor&&("constructor" in item.constructor)&&item.constructor.constructor===GeneratorFunction generator:item=>(typeof item=="object")&&("constructor" in item)&&item.constructor&&("constructor" in item.constructor)&&item.constructor.constructor===GeneratorFunction
} }
@ -7307,12 +7270,8 @@
'无名杀 - 录像 - '+_status.videoToSave.name[0]+' - '+_status.videoToSave.name[1]); '无名杀 - 录像 - '+_status.videoToSave.name[0]+' - '+_status.videoToSave.name[1]);
} }
}, },
genAsync:fn=>gnc.of(fn),
//genAwait:gen=>gnc.await(gen),
gnc:{ gnc:{
async:fn=>gnc.of(fn), of:fn=>gnc.of(fn),
//await:gen=>gnc.await(gen),
//escape:gen=>gnc.escape(gen),
is:{ is:{
coroutine:item=>gnc.is.coroutine(item), coroutine:item=>gnc.is.coroutine(item),
generatorFunc:item=>gnc.is.generatorFunc(item), generatorFunc:item=>gnc.is.generatorFunc(item),