mirror of
https://github.com/flynx/object.js.git
synced 2025-10-29 02:20:08 +00:00
tweaking stoppable...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
1944b5ceca
commit
ff294074d3
31
object.js
31
object.js
@ -396,8 +396,10 @@ var AsyncGenerator =
|
|||||||
module.AsyncGenerator =
|
module.AsyncGenerator =
|
||||||
(async function*(){}).constructor
|
(async function*(){}).constructor
|
||||||
|
|
||||||
|
|
||||||
// XXX should we have a generic generator that cand return STOP???
|
// XXX should we have a generic generator that cand return STOP???
|
||||||
|
|
||||||
|
|
||||||
// XXX
|
// XXX
|
||||||
var stoppable =
|
var stoppable =
|
||||||
module.stoppable =
|
module.stoppable =
|
||||||
@ -409,7 +411,17 @@ function(func){
|
|||||||
// in sync...
|
// in sync...
|
||||||
function*(){
|
function*(){
|
||||||
try{
|
try{
|
||||||
|
/* XXX should we return STOP???
|
||||||
yield* func.call(this, ...arguments)
|
yield* func.call(this, ...arguments)
|
||||||
|
/*/
|
||||||
|
for(var res of func.call(this, ...arguments)){
|
||||||
|
if(res === STOP){
|
||||||
|
return }
|
||||||
|
if(res instanceof STOP){
|
||||||
|
yield res.value
|
||||||
|
return }
|
||||||
|
yield res }
|
||||||
|
//*/
|
||||||
} catch(err){
|
} catch(err){
|
||||||
if(err === STOP){
|
if(err === STOP){
|
||||||
return
|
return
|
||||||
@ -423,7 +435,17 @@ function(func){
|
|||||||
// in sync...
|
// in sync...
|
||||||
async function*(){
|
async function*(){
|
||||||
try{
|
try{
|
||||||
|
/* XXX should we return STOP???
|
||||||
yield* func.call(this, ...arguments)
|
yield* func.call(this, ...arguments)
|
||||||
|
/*/
|
||||||
|
for(var res of func.call(this, ...arguments)){
|
||||||
|
if(res === STOP){
|
||||||
|
return }
|
||||||
|
if(res instanceof STOP){
|
||||||
|
yield res.value
|
||||||
|
return }
|
||||||
|
yield res }
|
||||||
|
//*/
|
||||||
} catch(err){
|
} catch(err){
|
||||||
if(err === STOP){
|
if(err === STOP){
|
||||||
return
|
return
|
||||||
@ -433,7 +455,16 @@ function(func){
|
|||||||
throw err } }
|
throw err } }
|
||||||
: function(){
|
: function(){
|
||||||
try{
|
try{
|
||||||
|
/* XXX should we return STOP???
|
||||||
return func.call(this, ...arguments)
|
return func.call(this, ...arguments)
|
||||||
|
/*/
|
||||||
|
var res = func.call(this, ...arguments)
|
||||||
|
if(res === STOP){
|
||||||
|
return }
|
||||||
|
if(res instanceof STOP){
|
||||||
|
return res.value }
|
||||||
|
return res
|
||||||
|
//*/
|
||||||
} catch(err){
|
} catch(err){
|
||||||
if(err === STOP){
|
if(err === STOP){
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user