add `lib.gnc.escape`
This commit is contained in:
parent
3b0edf0d27
commit
37ec12c866
|
@ -43,7 +43,7 @@
|
||||||
let result=gen;
|
let result=gen;
|
||||||
let nexts=resolve;
|
let nexts=resolve;
|
||||||
let throws=reject;
|
let throws=reject;
|
||||||
if(gnc.is.coroutine(gen)||(gnc.is.generator(gen)&&!gnc.nocoroutine)) {
|
if(gnc.is.coroutine(gen)||(gnc.is.generator(gen)&&!gen.nocoroutine)) {
|
||||||
if(!gen.status)gen.status="next";
|
if(!gen.status)gen.status="next";
|
||||||
if(!gen.state)gen.state=undefined;
|
if(!gen.state)gen.state=undefined;
|
||||||
try{
|
try{
|
||||||
|
@ -68,6 +68,10 @@
|
||||||
}
|
}
|
||||||
Promise.resolve(result).then(nexts,throws);
|
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"||gnc.is.generator(item))&&item.name=="genCoroutine",
|
||||||
generatorFunc:item=>item instanceof GeneratorFunction,
|
generatorFunc:item=>item instanceof GeneratorFunction,
|
||||||
|
@ -7269,6 +7273,7 @@
|
||||||
gnc:{
|
gnc:{
|
||||||
async:fn=>gnc.async(fn),
|
async:fn=>gnc.async(fn),
|
||||||
await:gen=>gnc.await(gen),
|
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),
|
||||||
|
|
Loading…
Reference in New Issue