|
14 | 14 | <a title="Promise Structure Reference"></a> |
15 | 15 | <header> |
16 | 16 | <div class="content-wrapper"> |
17 | | - <p><a href="../index.html">Tomorrowland 1.3.0 Docs</a> (100% documented)</p> |
| 17 | + <p><a href="../index.html">Tomorrowland 1.4.0 Docs</a> (100% documented)</p> |
18 | 18 | <p class="header-right"><a href="https://github.com/lilyball/Tomorrowland"><img src="../img/gh.png"/>View on GitHub</a></p> |
19 | 19 | </div> |
20 | 20 | </header> |
@@ -1681,7 +1681,8 @@ <h4>Return Value</h4> |
1681 | 1681 |
|
1682 | 1682 | <p>The returned <code>Promise</code> will always resolve with the same value that its receiver does, but |
1683 | 1683 | it won’t affect the timing of any of the receiver’s other observers and it won’t affect |
1684 | | -automatic cancellation propagation behavior.</p> |
| 1684 | +automatic cancellation propagation behavior. Requesting cancellation of the returned |
| 1685 | +<code>Promise</code> does nothing.</p> |
1685 | 1686 |
|
1686 | 1687 | <p><code>tap().always(on:token:_:)</code> behaves the same as <code><a href="../Structs/Promise.html#/s:12Tomorrowland7PromiseV3tap2on5token_ACyxq_GAA0B7ContextO_AA0B17InvalidationTokenVSgyAA0B6ResultOyxq_GctF">tap(on:token:_:)</a></code> except it returns a new |
1687 | 1688 | <code>Promise</code> whereas <code><a href="../Structs/Promise.html#/s:12Tomorrowland7PromiseV3tap2on5token_ACyxq_GAA0B7ContextO_AA0B17InvalidationTokenVSgyAA0B6ResultOyxq_GctF">tap(on:token:_:)</a></code> returns the receiver and can be inserted into any |
@@ -1731,6 +1732,16 @@ <h4>Return Value</h4> |
1731 | 1732 | <div class="pointer"></div> |
1732 | 1733 | <div class="abstract"> |
1733 | 1734 | <p>Registers a callback that will be invoked when the promise is cancelled.</p> |
| 1735 | +<div class="aside aside-note"> |
| 1736 | + <p class="aside-title">Note</p> |
| 1737 | + <p>Like <code>tap</code>, <code>onCancel</code> does not prevent automatic cancellation propagation if the |
| 1738 | +parent has multiple children and all other children have requested cancellation. Unlike |
| 1739 | +<code>tap</code>, requesting cancellation of <code>onCancel</code> will cancel the parent if the parent has no |
| 1740 | +other children. <code>onCancel</code>‘s behavior differs from the other standard obsrevers here as |
| 1741 | +attaching an <code>onCancel</code> observer to a promise that would otherwise be cancelled should not |
| 1742 | +prevent the cancellation.</p> |
| 1743 | + |
| 1744 | +</div> |
1734 | 1745 |
|
1735 | 1746 | </div> |
1736 | 1747 | <div class="declaration"> |
@@ -1824,6 +1835,13 @@ <h4>Return Value</h4> |
1824 | 1835 | <p>The intent of this method is to allow you to deduplicate requests for a long-lived resource |
1825 | 1836 | (such as a network load) without preventing cancellation of the load in the event that no |
1826 | 1837 | children care about it anymore.</p> |
| 1838 | +<div class="aside aside-important"> |
| 1839 | + <p class="aside-title">Important</p> |
| 1840 | + <p>Do not give the returned promise directly to callers. Instead always hand back |
| 1841 | +a child, such as returned from <code>makeChild</code>. Otherwise automatic cancellation propagation |
| 1842 | +won’t work as expected.</p> |
| 1843 | + |
| 1844 | +</div> |
1827 | 1845 |
|
1828 | 1846 | </div> |
1829 | 1847 | <div class="declaration"> |
@@ -1887,6 +1905,42 @@ <h4>Return Value</h4> |
1887 | 1905 | </section> |
1888 | 1906 | </div> |
1889 | 1907 | </li> |
| 1908 | + <li class="item"> |
| 1909 | + <div> |
| 1910 | + <code> |
| 1911 | + <a name="/s:12Tomorrowland7PromiseV9makeChildACyxq_GyF"></a> |
| 1912 | + <a name="//apple_ref/swift/Method/makeChild()" class="dashAnchor"></a> |
| 1913 | + <a class="token" href="#/s:12Tomorrowland7PromiseV9makeChildACyxq_GyF">makeChild()</a> |
| 1914 | + </code> |
| 1915 | + </div> |
| 1916 | + <div class="height-container"> |
| 1917 | + <div class="pointer-container"></div> |
| 1918 | + <section class="section"> |
| 1919 | + <div class="pointer"></div> |
| 1920 | + <div class="abstract"> |
| 1921 | + <p>Returns a promise that adopts the same value as the receiver.</p> |
| 1922 | + |
| 1923 | +<p>This method is used in order to hand back child promises to callers so that they cannot |
| 1924 | +directly request cancellation of a shared parent promise. This is most useful in conjunction |
| 1925 | +with <code><a href="../Structs/Promise.html#/s:12Tomorrowland7PromiseV23propagatingCancellation2on15cancelRequestedACyxq_GAA0B7ContextO_yAGctF">propagatingCancellation(on:cancelRequested:)</a></code> but could also be used any time a shared |
| 1926 | +promise is given to multiple callers.</p> |
| 1927 | + |
| 1928 | + </div> |
| 1929 | + <div class="declaration"> |
| 1930 | + <h4>Declaration</h4> |
| 1931 | + <div class="language"> |
| 1932 | + <p class="aside-title">Swift</p> |
| 1933 | + <pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">makeChild</span><span class="p">()</span> <span class="o">-></span> <span class="kt">Promise</span><span class="o"><</span><span class="kt">Value</span><span class="p">,</span> <span class="kt">Error</span><span class="o">></span></code></pre> |
| 1934 | + |
| 1935 | + </div> |
| 1936 | + </div> |
| 1937 | + <div> |
| 1938 | + <h4>Return Value</h4> |
| 1939 | + <p>A new promise that will resolve to the same value as the receiver.</p> |
| 1940 | + </div> |
| 1941 | + </section> |
| 1942 | + </div> |
| 1943 | + </li> |
1890 | 1944 | <li class="item"> |
1891 | 1945 | <div> |
1892 | 1946 | <code> |
@@ -3390,7 +3444,7 @@ <h4>Return Value</h4> |
3390 | 3444 | </section> |
3391 | 3445 | </section> |
3392 | 3446 | <section id="footer"> |
3393 | | - <p>© 2020 <a class="link" href="https://github.com/lilyball/Tomorrowland" target="_blank" rel="external">Lily Ballard</a>. All rights reserved. (Last updated: 2020-05-23)</p> |
| 3447 | + <p>© 2020 <a class="link" href="https://github.com/lilyball/Tomorrowland" target="_blank" rel="external">Lily Ballard</a>. All rights reserved. (Last updated: 2020-07-26)</p> |
3394 | 3448 | <p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.13.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p> |
3395 | 3449 | </section> |
3396 | 3450 | </article> |
|
0 commit comments