警告 : 请尽量避免使用 unwatch() 和 watch() . 这两个方法仅在 Gecko 中实现 , 并且他们过去主要作调试用. 另外, 使用 watchpoints 对性能有一系列的副面影响 ,特别是当使用全局对象,如 window. 你应该使用 setters and getters 或 proxies 来替代. 查阅 Browser compatibility 以获取更多信息.
unwatch() 删除一个 watch() 设置的 watchpoint.
obj.unwatch(prop)
propJavaScript调试器具有类似的功能,以及其他调试选项。有关调试器的信息 Venkman.
默认地, 这个方法 被每一个 Object 的子类继承
Note: The reason for unwatch() to take the property name prop as its only parameter is due to the "single handler allowing" behavior of the watch() method.
See watch().
Not part of any specifications. Implemented in JavaScript 1.2.
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | 未实现 | (Yes) | 未实现 | 未实现 | 未实现 |
| Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|
| Basic support | 未实现 | 未实现 | (Yes) | 未实现 | 未实现 | 未实现 |
Document 对象上调用 unwatch() 抛出 TypeError . This regression has been fixed with Firefox 27.