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

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

@@ -2,18 +2,18 @@
<div></div>
<p>该 <code><strong>ArrayBuffer[@@species]</strong></code> 访问器属性会返回 <code>ArrayBuffer</code> 构造器。</p>
<h2 id="语法">语法</h2>
<pre class="syntaxbox">ArrayBuffer[Symbol.species]
</pre>
<pre><code class="language-javascript">ArrayBuffer[Symbol.species]
</code></pre>
<h2 id="描述">描述</h2>
<p>这个 species 访问器属性会返回默认的 <code>ArrayBuffer</code> 构造器。子类构造器可能会覆盖它以改变构造器赋值。</p>
<h2 id="示例">示例</h2>
<p>返回默认的 <code>ArrayBuffer</code> 构造器:</p>
<pre class="brush: js">ArrayBuffer[Symbol.species]; // function ArrayBuffer()</pre>
<pre><code class="language-javascript">ArrayBuffer[Symbol.species]; // function ArrayBuffer()</code></pre>
<p>在派生集合对象中比如你定制的 array buffer <code>MyArrayBuffer</code><code>MyArrayBuffer</code> species 就是 <code>MyArrayBuffer</code> 构造器。但是,你可能想要在派生类里重写它,以期返回的是父类的 <code>ArrayBuffer</code> 对象:</p>
<pre class="brush: js">class MyArrayBuffer extends ArrayBuffer {
<pre><code class="language-javascript">class MyArrayBuffer extends ArrayBuffer {
// Overwrite MyArrayBuffer species to the parent ArrayBuffer constructor
static get [Symbol.species]() { return ArrayBuffer; }
}</pre>
}</code></pre>
<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>

View File

@@ -4,14 +4,14 @@
<div><iframe class="interactive interactive-js" frameborder="0" height="250" src="https://interactive-examples.mdn.mozilla.net/pages/js/arraybuffer-bytelength.html" width="100%"></iframe></div>
<p class="hidden">The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples 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="语法">语法</h2>
<pre class="syntaxbox"><var>arr</var>aybuffer.byteLength</pre>
<pre><code class="language-javascript"><var>arr</var>aybuffer.byteLength</code></pre>
<h2 id="描述">描述</h2>
<p>byteLength属性是一个访问器属性它的set访问器函数是undefined这意味着你只能读这个属性。 该值在数组创建时确定,并且不可变更。如果这个<code>ArrayBuffer</code> 被移除则此属性返回0。</p>
<p> </p>
<h2 id="示例">示例</h2>
<pre class="brush:js">var buffer = new ArrayBuffer(8);
<pre><code class="language-js">var buffer = new ArrayBuffer(8);
buffer.byteLength; // 8
</pre>
</code></pre>
<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>

View File

@@ -5,14 +5,14 @@
<div><iframe class="interactive interactive-js" frameborder="0" height="250" src="https://interactive-examples.mdn.mozilla.net/pages/js/arraybuffer-isview.html" width="100%"></iframe></div>
<p class="hidden">The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples 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="语法">语法</h2>
<pre class="syntaxbox"><code>ArrayBuffer.isView(<var>arg</var>)</code></pre>
<pre><code class="language-javascript"><code>ArrayBuffer.isView(<var>arg</var>)</code></code></pre>
<h3 id="Parameters参数">Parameters参数</h3>
<dl>
<dt><code>arg</code><br/>
    被检测的语句。</dt>
</dl>
<h2 id="示例">示例</h2>
<pre class="brush: js">ArrayBuffer.isView(); // false
<pre><code class="language-javascript">ArrayBuffer.isView(); // false
ArrayBuffer.isView([]); // false
ArrayBuffer.isView({}); // false
ArrayBuffer.isView(null); // false
@@ -26,7 +26,7 @@ ArrayBuffer.isView(new Int8Array(10).subarray(0, 3)); // true
var buffer = new ArrayBuffer(2);
var dv = new DataView(buffer);
ArrayBuffer.isView(dv); // true
</pre>
</code></pre>
<h2 id="说明文档">说明文档</h2>
<table class="standard-table">
<tbody>

View File

@@ -4,7 +4,7 @@
<div><iframe class="interactive interactive-js" frameborder="0" height="250" src="https://interactive-examples.mdn.mozilla.net/pages/js/arraybuffer-slice.html" width="100%"></iframe></div>
<p class="hidden">The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples 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="语法">语法</h2>
<pre class="syntaxbox">arraybuffer.slice(begin[, end])</pre>
<pre><code class="language-javascript">arraybuffer.slice(begin[, end])</code></pre>
<h3 id="参数">参数</h3>
<dl>
<dt><code>begin</code></dt>
@@ -20,9 +20,9 @@
<p><code>slice</code> 方法复制到但不包括由end参数指示的字节。如果begin或end是负数则指的是从数组末尾开始的索引而不是从头开始。</p>
<h2 id="示例">示例</h2>
<h3 id="复制一个_ArrayBuffer">复制一个 <code>ArrayBuffer</code></h3>
<pre class="brush: js">var buf1 = new ArrayBuffer(8);
<pre><code class="language-javascript">var buf1 = new ArrayBuffer(8);
var buf2 = buf1.slice(0);
</pre>
</code></pre>
<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>

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>