语法高亮,滚动条美化,设置页面调整

This commit is contained in:
fofolee
2019-04-19 02:41:09 +08:00
parent 1e8f76c000
commit 359d29ee0b
1590 changed files with 12328 additions and 11441 deletions

View File

@@ -3,10 +3,10 @@
<div> </div>
<p><code>AsyncFunction</code> 构造函数用来创建新的 <a href="Reference/Statements/async_function" title="async function 声明用于定义一个返回 AsyncFunction 对象的异步函数。异步函数是指通过事件循环异步执行的函数,它会通过一个隐式的 Promise 返回其结果。但是如果你的代码使用了异步函数,它的语法和结构会更像是标准的同步函数。"><code>异步函数</code></a> 对象JavaScript 中每个异步函数都是  <code>AsyncFunction</code> 的对象。</p>
<p>注意,<code>AsyncFunction</code> 并不是一个全局对象,需要通过下面的方法来获取:</p>
<pre class="brush: js">Object.getPrototypeOf(async function(){}).constructor
</pre>
<pre><code class="language-javascript">Object.getPrototypeOf(async function(){}).constructor
</code></pre>
<h2 id="语法">语法</h2>
<pre class="syntaxbox"><code>new AsyncFunction([<var>arg1</var>[, <var>arg2</var>[, ...<var>argN</var>]],] <var>functionBody</var>)</code></pre>
<pre><code class="language-javascript"><code>new AsyncFunction([<var>arg1</var>[, <var>arg2</var>[, ...<var>argN</var>]],] <var>functionBody</var>)</code></code></pre>
<h3 id="参数">参数</h3>
<dl>
<dt><code>arg1, arg2, ... arg<em>N</em></code></dt>
@@ -40,7 +40,7 @@
<p><code>AsyncFunction</code> 实例继承了 <a href="Reference/Global_Objects/AsyncFunction/prototype" title="AsyncFunction.prototype 属性表示 AsyncFunction 的原型对象。"><code>AsyncFunction.prototype</code></a> 的方法和属性。和所有构造函数一样,修改 <code>AsyncFunction</code> 构造函数的原型对象会同时对所有 <code>AsyncFunction</code> 实例上生效。</p>
<h2 id="示例">示例</h2>
<h3 id="通过_AsyncFunction_构造器创建一个异步函数">通过 <code>AsyncFunction</code> 构造器创建一个异步函数</h3>
<pre class="brush: js">function resolveAfter2Seconds(x) {
<pre><code class="language-javascript">function resolveAfter2Seconds(x) {
return new Promise(resolve =&gt; {
setTimeout(() =&gt; {
resolve(x);
@@ -55,7 +55,7 @@ var a = new AsyncFunction('a',
a(10, 20).then(v =&gt; {
console.log(v); // 4 秒后打印 30
});
</pre>
</code></pre>
<h2 id="规范">规范</h2>
<table class="standard-table">
<thead>