mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-12-15 07:06:53 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
</div></div>
|
||||
<p><strong>Object.unobserve()</strong> 是用来移除通过 <a href="Reference/Global_Objects/Object/observe" title="Object.observe() 方法用于异步地监视一个对象的修改。当对象属性被修改时,方法的回调函数会提供一个有序的修改流。然而,这个接口已经被废弃并从各浏览器中移除。你可以使用更通用的 Proxy 对象替代。"><code>Object.observe()</code></a>设置的观察者的方法。</p>
|
||||
<h2 id="语法">语法</h2>
|
||||
<pre class="syntaxbox"><code>Object.unobserve(<var>obj</var>, <var>callback</var>)</code></pre>
|
||||
<pre><code class="language-javascript"><code>Object.unobserve(<var>obj</var>, <var>callback</var>)</code></code></pre>
|
||||
<h3 id="参数">参数</h3>
|
||||
<dl>
|
||||
<dt><code>obj</code></dt>
|
||||
@@ -18,7 +18,7 @@
|
||||
<p>这个回调函数必须是一个函数的引用,而不能是一个匿名函数。因为这个引用将被用来移除之前设置的观察者方法。 给 <strong>Object.unobserve() </strong>传入匿名函数作为回调是不起作用的, 它不能移除任何观察者方法。</p>
|
||||
<h2 id="例子">例子</h2>
|
||||
<h3 id="观察一个对象">观察一个对象</h3>
|
||||
<pre class="brush: js">var obj = {
|
||||
<pre><code class="language-javascript">var obj = {
|
||||
foo: 0,
|
||||
bar: 1
|
||||
};
|
||||
@@ -35,9 +35,9 @@ obj.newProperty = 2;
|
||||
Object.unobserve(obj, observer);
|
||||
|
||||
obj.foo = 1;
|
||||
// 回调函数不会被调用</pre>
|
||||
// 回调函数不会被调用</code></pre>
|
||||
<h3 id="使用匿名函数">使用匿名函数</h3>
|
||||
<pre class="brush: js">var person = {
|
||||
<pre><code class="language-javascript">var person = {
|
||||
name : 'Ahmed',
|
||||
age : 25
|
||||
};
|
||||
@@ -56,7 +56,7 @@ Object.unobserve(person, function (changes) {
|
||||
person.age = 63;
|
||||
// [{name: 'age', object: <obj>, oldValue: 40, type: 'update'}]
|
||||
// 回调函数将会被调用
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="浏览器兼容性">浏览器兼容性</h2>
|
||||
<div><div class="blockIndicator warning"><strong><a class="external" href="https://github.com/mdn/browser-compat-data" rel="noopener">We're converting our compatibility data into a machine-readable JSON format</a></strong>.
|
||||
This compatibility table still uses the old format,
|
||||
|
||||
Reference in New Issue
Block a user