From bbe236d284ecd3a7e5ccd11e665b8ddeaf14ee65 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Wed, 4 Jan 2023 05:34:41 +0300 Subject: [PATCH] cleanup and notes... Signed-off-by: Alex A. Naanou --- Promise.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Promise.js b/Promise.js index a4e9f40..ee15a16 100644 --- a/Promise.js +++ b/Promise.js @@ -836,7 +836,7 @@ object.Constructor('IterablePromise', Promise, { // NOTE: that here a promise will block handling of later promises even // if they are resolved before it. // -// XXX BUG: +// XXX BUG (FIXED): // await Promise.seqiter([ // 1, // Promise.resolve(2), @@ -847,11 +847,12 @@ object.Constructor('IterablePromise', Promise, { // -> [ 1, 2, [3], [[4]], [[[5]]] ] // looks like we need to flatten things... // XXX FIXED but need more testing... +// XXX check if this behaves correctly (call order) on concatenation and +// other methods... // XXX not sure if this is a viable strategy.... var IterableSequentialPromise = module.IterableSequentialPromise = object.Constructor('IterableSequentialPromise', IterablePromise, { - // XXX needs more work... __pack: function(list, handler=undefined, onerror=undefined){ var seqiter = this.constructor @@ -864,7 +865,8 @@ object.Constructor('IterableSequentialPromise', IterablePromise, { && i < list.length-1){ res.push(e .then(function(e){ - return seqiter([...e, ...list.slice(i+1)]) + return seqiter( + [...e, ...list.slice(i+1)]) .flat() })) break } res.push(e) } @@ -883,7 +885,6 @@ object.Constructor('IterableSequentialPromise', IterablePromise, { : list return handler ? - // XXX this seems to be wrong... this.__handle(list, handler, onerror) : list }, })