experimenting...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-06-19 14:04:03 +03:00
parent 41fd0c8a6a
commit 1c0179152f

View File

@ -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)