mirror of
https://github.com/flynx/types.js.git
synced 2025-12-19 09:51:40 +00:00
experimenting...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
41fd0c8a6a
commit
1c0179152f
10
generator.js
10
generator.js
@ -455,6 +455,7 @@ object.Mixin('AsyncGeneratorProtoMixin', 'soft', {
|
||||
// -> promise
|
||||
//
|
||||
// NOTE: this will unwind the generator...
|
||||
// XXX should we unwind???
|
||||
then: function(resolve, reject){
|
||||
var that = this
|
||||
var p = new Promise(async function(_resolve, _reject){
|
||||
@ -468,10 +469,17 @@ object.Mixin('AsyncGeneratorProtoMixin', 'soft', {
|
||||
&& p.catch(reject)
|
||||
return p },
|
||||
|
||||
// create an iterator promise...
|
||||
// XXX create an iterator promise...
|
||||
iter: function(handler=undefined){
|
||||
// XXX
|
||||
},
|
||||
// XXX not sure if this is the right way to go...
|
||||
// XXX should we unwind???
|
||||
iter2: async function*(handler=undefined){
|
||||
for async(var e of this){
|
||||
yield* handler ?
|
||||
handler.call(this, e)
|
||||
: [e] } },
|
||||
})
|
||||
|
||||
AsyncGeneratorMixin(AsyncGeneratorPrototype)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user