ig-types 6.24.22 → 6.24.23
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/README.md +63 -0
- package/package.json +1 -1
- package/test.js +2 -0
package/README.md
CHANGED
|
@@ -1651,6 +1651,69 @@ XXX should we support generators as input?
|
|
|
1651
1651
|
XXX should we support infinite generators as input?
|
|
1652
1652
|
-->
|
|
1653
1653
|
|
|
1654
|
+
Promise iteration supports three modes of synchronization:
|
|
1655
|
+
|
|
1656
|
+
1. handle on ready
|
|
1657
|
+
```
|
|
1658
|
+
.iter(
|
|
1659
|
+
[value, promise, promise, value], handler)
|
|
1660
|
+
+ . . +
|
|
1661
|
+
| R |
|
|
1662
|
+
+ R | +
|
|
1663
|
+
| +
|
|
1664
|
+
+ - - - - - - - - - - - - - - - -> resolve
|
|
1665
|
+
|
|
1666
|
+
R - input resolved
|
|
1667
|
+
```
|
|
1668
|
+
A handler is started as soon as it's value is ready/resolved, i.e.
|
|
1669
|
+
for non-promise values start immediately.
|
|
1670
|
+
|
|
1671
|
+
|
|
1672
|
+
2. handle sequentially when value is ready and previous handler is started
|
|
1673
|
+
```
|
|
1674
|
+
.seqstartiter(
|
|
1675
|
+
[value, promise, promise, value], handler)
|
|
1676
|
+
+ . . . |
|
|
1677
|
+
| R <-+
|
|
1678
|
+
++- - >R . . |
|
|
1679
|
+
| | <-+
|
|
1680
|
+
+ ++ - - - >+ . |
|
|
1681
|
+
. | | <-+
|
|
1682
|
+
+ + - - > + |
|
|
1683
|
+
. . | <-+
|
|
1684
|
+
+ - - - - - - - > resolve
|
|
1685
|
+
^ ^
|
|
1686
|
+
+------+-- returned promise
|
|
1687
|
+
R - input resolved
|
|
1688
|
+
```
|
|
1689
|
+
A handler is started as soon as all previous handlers are started
|
|
1690
|
+
and the current value is ready/resolved.
|
|
1691
|
+
|
|
1692
|
+
|
|
1693
|
+
3. handle sequentially when value is ready and previous handler is resolved
|
|
1694
|
+
```
|
|
1695
|
+
.seqiter(
|
|
1696
|
+
[value, promise, promise, value], handler)
|
|
1697
|
+
+ . . . |
|
|
1698
|
+
| R <-+
|
|
1699
|
+
++- - >R . . |
|
|
1700
|
+
| | <-+
|
|
1701
|
+
+ ++ . . |
|
|
1702
|
+
. | |
|
|
1703
|
+
+ - - - >+ . |
|
|
1704
|
+
. . | <-+
|
|
1705
|
+
+ - - > + |
|
|
1706
|
+
. . | <-+
|
|
1707
|
+
+ - - - - - - - > resolve
|
|
1708
|
+
^ ^
|
|
1709
|
+
+------+-- returned promise
|
|
1710
|
+
R - input resolved
|
|
1711
|
+
```
|
|
1712
|
+
A handler is started as soon as all previous handlers are done, their
|
|
1713
|
+
return values are resolved and the current value is ready/resolved.
|
|
1714
|
+
|
|
1715
|
+
|
|
1716
|
+
|
|
1654
1717
|
|
|
1655
1718
|
#### `Promise.iter(..)` / `promise.IterablePromise(..)`
|
|
1656
1719
|
|
package/package.json
CHANGED