mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-12-17 08:26:32 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<div><iframe class="interactive interactive-js" frameborder="0" height="250" src="https://interactive-examples.mdn.mozilla.net/pages/js/promise-race.html" width="100%"></iframe></div>
|
||||
<p class="hidden">The source for this interactive demo is stored in a GitHub repository. If you'd like to contribute to the interactive demo project, please clone <a class="external" href="https://github.com/mdn/interactive-examples" rel="noopener">https://github.com/mdn/interactive-examples</a> and send us a pull request.</p>
|
||||
<h2 id="Syntax" name="Syntax">语法</h2>
|
||||
<pre class="syntaxbox"><var>Promise.race(iterable)</var>;</pre>
|
||||
<pre><code class="language-javascript"><var>Promise.race(iterable)</var>;</code></pre>
|
||||
<h3 id="参数"><strong>参数</strong></h3>
|
||||
<dl>
|
||||
<dt>iterable</dt>
|
||||
@@ -35,9 +35,9 @@ setTimeout(function(){
|
||||
// logs, in order:
|
||||
// Promise { <state>: "pending" }
|
||||
// the stack is now empty
|
||||
// Promise { <state>: "fulfilled", <value>: 33 }</code></pre>
|
||||
// Promise { <state>: "fulfilled", <value>: 33 }</code></code></pre>
|
||||
<h3 id="使用_Promise.race_–_setTimeout_的示例"><code><font face="Open Sans, sans-serif">使用 </font>Promise.race</code> – <code>setTimeout 的示例</code></h3>
|
||||
<pre class="brush: js">var p1 = new Promise(function(resolve, reject) {
|
||||
<pre><code class="language-javascript">var p1 = new Promise(function(resolve, reject) {
|
||||
setTimeout(resolve, 500, "one");
|
||||
});
|
||||
var p2 = new Promise(function(resolve, reject) {
|
||||
@@ -76,7 +76,7 @@ Promise.race([p5, p6]).then(function(value) {
|
||||
console.log(reason); // "six"
|
||||
// p6 更快,所以它失败了
|
||||
});
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user