mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-12-15 23:37:25 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<div><div class="blockIndicator obsolete obsoleteHeader"><p><strong><span class="icon-only-inline" title="This is an obsolete API and is no longer guaranteed to work."><i class="icon-trash"> </i></span> 已废弃</strong><br/>This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.</p></div></div>
|
||||
<p><strong>Array.observe()</strong> 方法用于异步监视数组发生的变化,类似于针对对象的 <a href="Reference/Global_Objects/Object/observe" title="Object.observe() 方法用于异步地监视一个对象的修改。当对象属性被修改时,方法的回调函数会提供一个有序的修改流。然而,这个接口已经被废弃并从各浏览器中移除。你可以使用更通用的 Proxy 对象替代。"><code>Object.observe()</code></a> 。当数组的值发生变化时,它按发生顺序提供了一个变化流。与 <code>Object.observe()</code> 类似,它由如下可接受的变化类型列表<code>["add"、"update"、"delete"、"splice"]</code>触发。</p>
|
||||
<h2 id="语法">语法</h2>
|
||||
<pre class="syntaxbox"><code>Array.observe(<var>arr</var>, <var>callback</var>)</code></pre>
|
||||
<pre><code class="language-javascript"><code>Array.observe(<var>arr</var>, <var>callback</var>)</code></code></pre>
|
||||
<h3 id="参数">参数</h3>
|
||||
<dl>
|
||||
<dt><code>arr</code></dt>
|
||||
@@ -32,7 +32,7 @@
|
||||
</div>
|
||||
<h2 id="示例">示例</h2>
|
||||
<h3 id="Example_Logging_different_change_types">Example: Logging different change types</h3>
|
||||
<pre class="brush: js">var arr = ['a', 'b', 'c'];
|
||||
<pre><code class="language-javascript">var arr = ['a', 'b', 'c'];
|
||||
|
||||
Array.observe(arr, function(changes) {
|
||||
console.log(changes);
|
||||
@@ -46,7 +46,7 @@ arr[3] = 'd';
|
||||
|
||||
arr.splice(1, 2, 'beta', 'gamma', 'delta');
|
||||
// [{type: 'splice', object: <arr>, index: 1, removed: ['B', 'c'], addedCount: 3}]
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="Specifications" name="Specifications">标准规范</h2>
|
||||
<p><a class="external" href="https://github.com/arv/ecmascript-object-observe" rel="noopener">Strawman proposal specification</a>.</p>
|
||||
<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器支持</h2>
|
||||
|
||||
Reference in New Issue
Block a user