Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-12-08 01:41:39 +03:00
parent 579fd05323
commit 0c492c7177
2 changed files with 5 additions and 0 deletions

View File

@ -1049,6 +1049,7 @@ object.Mixin('PromiseMixin', 'soft', {
sync: SyncPromise,
// XXX should this be implemented via SyncPromise???
// XXX not sure if we need to expand async generators...
// (update README if this changes)
awaitOrRun: function(data, func, error){
data = [...arguments]
func = data.pop()
@ -1073,6 +1074,7 @@ object.Mixin('PromiseMixin', 'soft', {
// XXX not sure if we need to expand async generators...
// ...since it has .then(..) it can be treated as a promise...
// XXX should we just check for .then(..) ???
// XXX update README if this changes...
: (data.length == 1
&& Symbol.asyncIterator in data[0]
&& 'then' in data[0]) ?

View File

@ -2117,6 +2117,9 @@ Note that if the last `<value>` is a function and no `<onerror>` function
is given then `.awaitOrRun(..)` will confuse the `<value>` for `<func>`,
to avoid this one needs to explicitly pass `null`/`undefined` as `<onerror>`.
_Special-case: this will expand async generators if they define `.then(..)`,
this may change in the future._
## Generator extensions and utilities