From e7abfb929f2ff029f4ebe46d4ee9a28568deb64d Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Fri, 22 Jul 2016 22:54:43 +0300 Subject: [PATCH] use generator delegation --- example.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/example.js b/example.js index b197136..91c0e58 100644 --- a/example.js +++ b/example.js @@ -27,7 +27,7 @@ function* test_throttle(thread) console.log('at most 5'); yield setTimeout(thread, 1000); console.log('continue in another generator'); - yield gen.run(other_gen, null, thread); + yield* other_gen(thread); // same as 'yield gen.run(other_gen, null, thread)' } function* other_gen(thread) @@ -53,8 +53,8 @@ function* test_throw(thread) console.log('continue'); } -//gen.run(test, null, function(result) { console.log(result); }); +gen.run(test, null, function(result) { console.log(result); }); -//for (var i = 0; i < 15; i++) gen.run(test_throttle); +for (var i = 0; i < 15; i++) gen.run(test_throttle); gen.run(test_throw);