mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-09 23:44:06 +08:00
90 lines
5.1 KiB
HTML
90 lines
5.1 KiB
HTML
<article id="wikiArticle">
|
||
<div></div>
|
||
<div class="warning">
|
||
<p><strong>警告 :</strong> 请尽量避免使用 unwatch() 和 <a href="Reference/Global_Objects/Object/watch" title="undefined."><code>watch()</code></a> . 这两个方法仅在 Gecko 中实现 , 并且他们过去主要作调试用. 另外, 使用 watchpoints 对性能有一系列的副面影响 ,特别是当使用全局对象,如 <code>window</code>. 你应该使用 <a href="/en-US/docs/Web/JavaScript/Guide/Working_with_Objects#Defining_getters_and_setters">setters and getters</a> 或 proxies 来替代. 查阅 <a href="#Browser_compatibility">Browser compatibility</a> 以获取更多信息.</p>
|
||
</div>
|
||
<p><code><strong>unwatch()</strong></code> 删除一个 <a href="Reference/Global_Objects/Object/watch" title="undefined."><code>watch()</code></a> 设置的 watchpoint.</p>
|
||
<h2 id="语法">语法</h2>
|
||
<pre><code class="language-javascript"><code><var>obj</var>.unwatch(<var>prop</var>)</code></code></pre>
|
||
<h3 id="参数">参数</h3>
|
||
<dl>
|
||
<dt><code>prop</code></dt>
|
||
<dd>想要停止监视的对象的属性名</dd>
|
||
</dl>
|
||
<h2 id="描述">描述</h2>
|
||
<p>JavaScript调试器具有类似的功能,以及其他调试选项。有关调试器的信息 <a href="/en-US/docs/Venkman">Venkman</a>.</p>
|
||
<p>默认地, 这个方法 被每一个 <a href="Reference/Global_Objects/Object" title="Object 构造函数创建一个对象包装器。"><code>Object</code></a> 的子类继承 </p>
|
||
<div class="note">
|
||
<p><strong>Note:</strong> The reason for <code>unwatch()</code> to take the property name <em>prop</em> as its only parameter is due to the "single handler allowing" behavior of the <a href="Reference/Global_Objects/Object/watch" title="undefined."><code>watch()</code></a> method.</p>
|
||
</div>
|
||
<h2 id="例子">例子</h2>
|
||
<p>See <a href="Reference/Global_Objects/Object/watch" title="undefined."><code>watch()</code></a>.</p>
|
||
<h2 id="说明">说明</h2>
|
||
<p>Not part of any specifications. Implemented in JavaScript 1.2.</p>
|
||
<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,
|
||
because we haven't yet converted the data it contains.
|
||
<strong><a class="new" href="/zh-CN/docs/MDN/Contribute/Structures/Compatibility_tables" rel="nofollow">Find out how you can help!</a></strong></div>
|
||
<div class="htab">
|
||
<a id="AutoCompatibilityTable" name="AutoCompatibilityTable"></a>
|
||
<ul>
|
||
<li class="selected"><a>Desktop</a></li>
|
||
<li><a>Mobile</a></li>
|
||
</ul>
|
||
</div></div>
|
||
<div id="compat-desktop">
|
||
<table class="compat-table">
|
||
<tbody>
|
||
<tr>
|
||
<th>Feature</th>
|
||
<th>Chrome</th>
|
||
<th>Firefox (Gecko)</th>
|
||
<th>Internet Explorer</th>
|
||
<th>Opera</th>
|
||
<th>Safari</th>
|
||
</tr>
|
||
<tr>
|
||
<td>Basic support</td>
|
||
<td><span style="color: #f00;">未实现</span></td>
|
||
<td><span style="color: #888;" title="Please update this with the earliest version of support.">(Yes)</span></td>
|
||
<td><span style="color: #f00;">未实现</span></td>
|
||
<td><span style="color: #f00;">未实现</span></td>
|
||
<td><span style="color: #f00;">未实现</span></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div id="compat-mobile">
|
||
<table class="compat-table">
|
||
<tbody>
|
||
<tr>
|
||
<th>Feature</th>
|
||
<th>Android</th>
|
||
<th>Chrome for Android</th>
|
||
<th>Firefox Mobile (Gecko)</th>
|
||
<th>IE Mobile</th>
|
||
<th>Opera Mobile</th>
|
||
<th>Safari Mobile</th>
|
||
</tr>
|
||
<tr>
|
||
<td>Basic support</td>
|
||
<td><span style="color: #f00;">未实现</span></td>
|
||
<td><span style="color: #f00;">未实现</span></td>
|
||
<td><span style="color: #888;" title="Please update this with the earliest version of support.">(Yes)</span></td>
|
||
<td><span style="color: #f00;">未实现</span></td>
|
||
<td><span style="color: #f00;">未实现</span></td>
|
||
<td><span style="color: #f00;">未实现</span></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<h2 id="Compatibility_notes">Compatibility notes</h2>
|
||
<ul>
|
||
<li>从 Firefox 23 (<a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=903332" rel="noopener" title="FIXED: document.watch() results in "TypeError: can't watch non-native objects of class Proxy"">bug 903332</a>) 开始, 在 <a href="/zh-CN/docs/Web/API/Document" title="Document接口表示任何在浏览器中已经加载好的网页,并作为一个入口去操作网页内容(也就是DOM tree)。DOM tree包括像 <body> 、<table>这样的还有其他的元素。它提供了全局操作document的功能,像获取网页的URL和在document里创建一个新的元素。"><code>Document</code></a> 对象上调用 <code>unwatch()</code> 抛出 <a href="Reference/Global_Objects/TypeError" title="TypeError(类型错误) 对象用来表示值的类型非预期类型时发生的错误。"><code>TypeError</code></a> . This regression has been fixed with Firefox 27.</li>
|
||
</ul>
|
||
<h2 id="相关链接">相关链接</h2>
|
||
<ul>
|
||
<li><a href="Reference/Global_Objects/Object/watch" title="undefined."><code>Object.watch()</code></a></li>
|
||
</ul>
|
||
</article> |