diff options
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/promise/index.html')
| -rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/promise/index.html | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/promise/index.html b/files/zh-cn/web/javascript/reference/global_objects/promise/index.html index dd878cb92d..8b6cd1cd19 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/promise/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/promise/index.html @@ -32,14 +32,14 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Promise <p>因为 <code>{{jsxref("Promise.then", "Promise.prototype.then")}}</code> 和 <code>{{jsxref("Promise.catch", "Promise.prototype.catch")}}</code> 方法返回的是 promise, 所以它们可以被链式调用。</p> -<p><img alt="" src="https://mdn.mozillademos.org/files/8633/promises.png" style="height: 297px; width: 801px;"></p> +<p><img alt="" src="https://mdn.mozillademos.org/files/8633/promises.png"></p> <div class="note"> -<p><strong>不要和惰性求值混淆:</strong> 有一些语言中有惰性求值和延时计算的特性,它们也被称为“promises”,例如 Scheme。JavaScript 中的 promise 代表的是已经正在发生的进程, 而且可以通过回调函数实现链式调用。 如果您想对一个表达式进行惰性求值,就考虑一下使用无参数的"<a href="/zh-CN/docs/Web/JavaScript/Reference/Functions/Arrow_functions">箭头函数</a>": <code>f = () =></code><em><code>表达式</code> </em>来创建惰性求值的表达式<em>,</em>使用 <code>f()</code><strong> </strong>求值。</p> +<p><strong>备注:</strong> 有一些语言中有惰性求值和延时计算的特性,它们也被称为“promises”,例如 Scheme。JavaScript 中的 promise 代表的是已经正在发生的进程, 而且可以通过回调函数实现链式调用。 如果您想对一个表达式进行惰性求值,就考虑一下使用无参数的"<a href="/zh-CN/docs/Web/JavaScript/Reference/Functions/Arrow_functions">箭头函数</a>": <code>f = () =></code><em><code>表达式</code> </em>来创建惰性求值的表达式<em>,</em>使用 <code>f()</code><strong> </strong>求值。</p> </div> <div class="note"> -<p><strong>注意:</strong> 如果一个 promise 已经被兑现(fulfilled)或被拒绝(rejected),那么我们也可以说它处于<em>已敲定(settled)</em>状态。您还会听到一个经常跟 promise 一起使用的术语:<em>已决议(resolved)</em>,它表示 promise 已经处于已敲定(settled)状态,或者为了匹配另一个 promise 的状态被"锁定"了。Domenic Denicola 的 <a href="https://github.com/domenic/promises-unwrapping/blob/master/docs/states-and-fates.md">States and fates</a> 中有更多关于 promise 术语的细节可以供您参考。</p> +<p><strong>备注:</strong> 如果一个 promise 已经被兑现(fulfilled)或被拒绝(rejected),那么我们也可以说它处于<em>已敲定(settled)</em>状态。您还会听到一个经常跟 promise 一起使用的术语:<em>已决议(resolved)</em>,它表示 promise 已经处于已敲定(settled)状态,或者为了匹配另一个 promise 的状态被"锁定"了。Domenic Denicola 的 <a href="https://github.com/domenic/promises-unwrapping/blob/master/docs/states-and-fates.md">States and fates</a> 中有更多关于 promise 术语的细节可以供您参考。</p> </div> <h3 id="Promise的链式调用">Promise的链式调用</h3> |
