ig-types 6.24.23 → 6.24.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/Promise.js +26 -23
  2. package/package.json +1 -1
package/Promise.js CHANGED
@@ -944,27 +944,30 @@ object.Constructor('IterableSequentialStartPromise', IterablePromise, {
944
944
 
945
945
 
946
946
  // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
947
- // XXX might also be a good idea to implement a version of the above to
948
- // handle the next element only after the promise returned by the
949
- // previous handler is resolved -- depth first...
950
- // ...this would help prevent the await execution uncertainty, i.e.:
951
- // console.log(1)
952
- // // note that we are NOTE await'ing for the function here...
953
- // (async function f(){
954
- // console.log(2)})()
955
- // console.log(3)
956
- // -> prints 1, 2, 3
957
- // and:
958
- // console.log(1)
959
- // (async function f(){
960
- // // note the await -- this is the only difference...
961
- // console.log(await 2)})()
962
- // console.log(3)
963
- // -> prints 1, 3, 2
964
- // this is bad because of a handler has two execution paths one with
965
- // an await and one without the order of actual handler execution can
966
- // not be controlled unless we wait for the whole thing to resolve...
967
- //
947
+ // Like IterableSequentialStartPromise(..) but each handler will be
948
+ // called after the previous handler's return value is resolved (if it
949
+ // is a promise).
950
+ //
951
+ // This is needed to control the "unpredictable" behavior of await's in
952
+ // JavaScript, here is a trivial example with an async function starting
953
+ // as if it was sync and as a promise on the next execution frame:
954
+ // console.log(1)
955
+ // // note that we are NOTE await'ing for the function here...
956
+ // (async function f(){
957
+ // console.log(2)})()
958
+ // console.log(3)
959
+ // -> prints 1, 2, 3
960
+ // and:
961
+ // console.log(1)
962
+ // (async function f(){
963
+ // // note the await -- this is the only difference...
964
+ // console.log(await 2)})()
965
+ // console.log(3)
966
+ // -> prints 1, 3, 2
967
+ // this is bad because if a handler has two execution paths one with
968
+ // an await and one without the order of actual handler execution can
969
+ // not be controlled predictably unless we wait for the whole thing to
970
+ // resolve...
968
971
  var IterableSequentialPromise =
969
972
  module.IterableSequentialPromise =
970
973
  object.Constructor('IterableSequentialPromise', IterableSequentialStartPromise, {
@@ -1327,8 +1330,8 @@ object.Mixin('PromiseMixin', 'soft', {
1327
1330
  // XXX should we just check for .then(..) ???
1328
1331
  // XXX update README if this changes...
1329
1332
  : (data.length == 1
1330
- && Symbol.asyncIterator in data[0]
1331
- && 'then' in data[0]) ?
1333
+ && data[0][Symbol.asyncIterator]
1334
+ && data[0].then) ?
1332
1335
  data[0].then(func, ...error)
1333
1336
  : error.length > 0 ?
1334
1337
  function(){
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ig-types",
3
- "version": "6.24.23",
3
+ "version": "6.24.24",
4
4
  "description": "Generic JavaScript types and type extensions...",
5
5
  "main": "main.js",
6
6
  "scripts": {