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.
- package/Promise.js +26 -23
- package/package.json +1 -1
package/Promise.js
CHANGED
|
@@ -944,27 +944,30 @@ object.Constructor('IterableSequentialStartPromise', IterablePromise, {
|
|
|
944
944
|
|
|
945
945
|
|
|
946
946
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
947
|
-
//
|
|
948
|
-
//
|
|
949
|
-
//
|
|
950
|
-
//
|
|
951
|
-
//
|
|
952
|
-
//
|
|
953
|
-
//
|
|
954
|
-
//
|
|
955
|
-
//
|
|
956
|
-
//
|
|
957
|
-
//
|
|
958
|
-
//
|
|
959
|
-
//
|
|
960
|
-
//
|
|
961
|
-
//
|
|
962
|
-
//
|
|
963
|
-
//
|
|
964
|
-
//
|
|
965
|
-
//
|
|
966
|
-
//
|
|
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
|
-
&&
|
|
1331
|
-
&&
|
|
1333
|
+
&& data[0][Symbol.asyncIterator]
|
|
1334
|
+
&& data[0].then) ?
|
|
1332
1335
|
data[0].then(func, ...error)
|
|
1333
1336
|
: error.length > 0 ?
|
|
1334
1337
|
function(){
|