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

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

@@ -4,7 +4,7 @@
</div></div>
<p> 静态<code><strong>ArrayBuf</strong></code><strong>fer.transfer()</strong> 方法返回一个新的ArrayBuffer 其内容取自oldBuffer的数据并且根据 newByteLength 的大小来对数据进行截取或者以0扩展。 如果 newByteLength 未定义,则使用 oldBuffer 的byteLength。这个操作使得 oldBuffer 处于被移除的状态。</p>
<h2 id="语法">语法</h2>
<pre class="syntaxbox">ArrayBuffer.transfer(oldBuffer [, newByteLength]);</pre>
<pre><code class="language-javascript">ArrayBuffer.transfer(oldBuffer [, newByteLength]);</code></pre>
<h3 id="参数">参数</h3>
<dl>
<dt><code>oldBuffer</code></dt>
@@ -17,7 +17,7 @@
<h2 id="描述">描述</h2>
<p><code>ArrayBuffer.transfer()</code>方法允许你增长和移除 <code>ArrayBuffer</code> 对象。不需复制就能增长一个ArrayBuffer的功能对于大的缓冲区来说有速度优势 (类似realloc) 。当释放底层内存时移除ArrayBuffer的功能给开发者提供了显式控制。这避免了必须丢弃所有引用和等待垃圾回收。</p>
<h2 id="示例">示例</h2>
<pre class="brush: js">var buf1 = new ArrayBuffer(40);
<pre><code class="language-javascript">var buf1 = new ArrayBuffer(40);
new Int32Array(buf1)[0] = 42;
var buf2 = ArrayBuffer.transfer(buf1, 80);
@@ -28,7 +28,7 @@ new Int32Array(buf2)[0]; // 42
var buf3 = ArrayBuffer.transfer(buf2, 0);
buf2.byteLength; // 0 but if you use the polyfill then the value is still 80
buf3.byteLength; // 0
</pre>
</code></pre>
<h2 id="Polyfill">Polyfill</h2>
<p>You can partially work around this by inserting the following code at the beginning of your scripts, allowing use of much of the functionality of transfer<font face="Consolas, Liberation Mono, Courier, monospace">()</font> in implementations that do not natively support it. This is not the exact equivalent of this API, but this function transfers data from one ArrayBuffer to another ArrayBuffer.</p>
<pre>if(!ArrayBuffer.transfer) {
@@ -81,7 +81,7 @@ buf3.byteLength; // 0
}
}
};
}</pre>
}</code></pre>
<h2 id="规范">规范</h2>
<p>Not part of any current specification draft document, but <a class="external" href="https://esdiscuss.org/topic/sept-23-2014-meeting-notes" rel="noopener">has been</a> <a class="external" href="https://gist.github.com/lukewagner/2735af7eea411e18cf20" rel="noopener">proposed</a> for a future ECMA-262 edition.</p>
<h2 id="浏览器兼容性">浏览器兼容性</h2>