diff options
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/promise')
6 files changed, 6 insertions, 6 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/promise/allsettled/index.html b/files/zh-cn/web/javascript/reference/global_objects/promise/allsettled/index.html index d552f10680..a448dfb79b 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/promise/allsettled/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/promise/allsettled/index.html @@ -13,7 +13,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Promise/allSettled <p>当您有多个彼此不依赖的异步任务成功完成时,或者您总是想知道每个<code>promise</code>的结果时,通常使用它。</p> -<p><font><font>相比之下,</font></font><code><a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise/all">Promise.all()</a></code><font><font> 更适合彼此相互依赖或者在其中任何一个<code>reject</code>时立即结束。</font></font></p> +<p>相比之下,<code><a href="https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Promise/all">Promise.all()</a></code> 更适合彼此相互依赖或者在其中任何一个<code>reject</code>时立即结束。</p> <div>{{EmbedInteractiveExample("pages/js/promise-allsettled.html")}}</div> 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 e8ff35c09e..3dd832b401 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 @@ -262,7 +262,7 @@ function testPromise() { <h2 id="使用_XHR_加载图像">使用 XHR 加载图像</h2> -<p><font face="Open Sans, sans-serif">另一个用了 </font>Promise <font face="Open Sans, sans-serif">和</font><a href="/en-US/docs/Web/API/XMLHttpRequest"> XMLHttpRequest</a> 加载一个图像的例子可在MDN GitHub<a href="https://github.com/mdn/js-examples/tree/master/promises-test"> promise-test</a> 中找到。 您也可以<a href="https://mdn.github.io/js-examples/promises-test/">看这个实例</a>。每一步都有注释可以让您详细的了解Promise和XHR架构。</p> +<p>另一个用了 Promise 和<a href="/en-US/docs/Web/API/XMLHttpRequest"> XMLHttpRequest</a> 加载一个图像的例子可在MDN GitHub<a href="https://github.com/mdn/js-examples/tree/master/promises-test"> promise-test</a> 中找到。 您也可以<a href="https://mdn.github.io/js-examples/promises-test/">看这个实例</a>。每一步都有注释可以让您详细的了解Promise和XHR架构。</p> <h2 id="规范">规范</h2> diff --git a/files/zh-cn/web/javascript/reference/global_objects/promise/promise/index.html b/files/zh-cn/web/javascript/reference/global_objects/promise/promise/index.html index e79512fa51..4af6e48f93 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/promise/promise/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/promise/promise/index.html @@ -19,7 +19,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Promise/Promise <dl> <dt><code>executor</code></dt> - <dd>这是一个双参函数,参数为<code>resolve<font face="Arial, x-locale-body, sans-serif">和</font>reject</code>。<code>Promise</code>的实现会立即执行<code>executor</code>,并传入<code>resolve<font face="Arial, x-locale-body, sans-serif">和</font>reject</code>函数(<code>Promise</code>构造器将会在返回新对象之前<code>executor</code>)。当<code>resolve</code>和<code>reject</code>函数被调用时,它们分别对promise执行<code>resolve</code>和<code>reject</code>。<code>executor</code>通常会触发一些异步运算,一旦运算成功完成,则<code>resolve</code>掉这个promise,如果出错则<code>reject</code>掉。如果<code>executor</code>函数执行时抛出异常,promise状态会变为<code>rejected</code>。<code>executor</code>的返回值也会被忽略。</dd> + <dd>这是一个双参函数,参数为<code>resolve和reject</code>。<code>Promise</code>的实现会立即执行<code>executor</code>,并传入<code>resolve和reject</code>函数(<code>Promise</code>构造器将会在返回新对象之前<code>executor</code>)。当<code>resolve</code>和<code>reject</code>函数被调用时,它们分别对promise执行<code>resolve</code>和<code>reject</code>。<code>executor</code>通常会触发一些异步运算,一旦运算成功完成,则<code>resolve</code>掉这个promise,如果出错则<code>reject</code>掉。如果<code>executor</code>函数执行时抛出异常,promise状态会变为<code>rejected</code>。<code>executor</code>的返回值也会被忽略。</dd> </dl> <h2 id="例子">例子</h2> diff --git a/files/zh-cn/web/javascript/reference/global_objects/promise/race/index.html b/files/zh-cn/web/javascript/reference/global_objects/promise/race/index.html index ff251633c0..fab2fd64a9 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/promise/race/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/promise/race/index.html @@ -59,7 +59,7 @@ setTimeout(function(){ // the stack is now empty // Promise { <state>: "fulfilled", <value>: 33 }</pre> -<h3 id="使用_Promise.race_–_setTimeout_的示例"><font face="Open Sans, sans-serif">使用 </font>Promise.race – setTimeout 的示例</h3> +<h3 id="使用_Promise.race_–_setTimeout_的示例">使用 Promise.race – setTimeout 的示例</h3> <pre class="brush: js notranslate">var p1 = new Promise(function(resolve, reject) { setTimeout(resolve, 500, "one"); diff --git a/files/zh-cn/web/javascript/reference/global_objects/promise/reject/index.html b/files/zh-cn/web/javascript/reference/global_objects/promise/reject/index.html index f5a8f82156..aff5a4047b 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/promise/reject/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/promise/reject/index.html @@ -33,7 +33,7 @@ translation_of: Web/JavaScript/Reference/Global_Objects/Promise/reject <h2 id="Description" name="Description">描述</h2> -<p><font face="Open Sans, sans-serif">静态函数</font><code>Promise.reject</code>返回一个被拒绝的<code>Promise对象</code>。通过使用{{jsxref("Error")}}的实例获取错误原因<code>reason</code>对调试和选择性错误捕捉很有帮助。</p> +<p>静态函数<code>Promise.reject</code>返回一个被拒绝的<code>Promise对象</code>。通过使用{{jsxref("Error")}}的实例获取错误原因<code>reason</code>对调试和选择性错误捕捉很有帮助。</p> <h2 id="示例">示例</h2> diff --git a/files/zh-cn/web/javascript/reference/global_objects/promise/then/index.html b/files/zh-cn/web/javascript/reference/global_objects/promise/then/index.html index a4180c8e14..d5193c8498 100644 --- a/files/zh-cn/web/javascript/reference/global_objects/promise/then/index.html +++ b/files/zh-cn/web/javascript/reference/global_objects/promise/then/index.html @@ -101,7 +101,7 @@ p1.then(value => { <h3 id="链式调用">链式调用</h3> -<p><font face="Open Sans, sans-serif"><code>then</code> 方法返回</font>一个 <code>Promise</code> 对象,其允许方法链。</p> +<p><code>then</code> 方法返回一个 <code>Promise</code> 对象,其允许方法链。</p> <p>你可以传递一个匿名函数给 <code>then</code>,并且,如果它返回一个 <code>Promise</code>,一个等价的 <code>Promise</code> 将暴露给后续的方法链。下面的代码片段使用 <code>setTimout</code> 函数来模拟异步代码操作。</p> |