aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/global_objects/proxy/handler/isextensible
diff options
context:
space:
mode:
authorFlorian Merz <me@fiji-flo.de>2021-02-11 12:56:40 +0100
committerFlorian Merz <me@fiji-flo.de>2021-02-11 12:56:40 +0100
commit310fd066e91f454b990372ffa30e803cc8120975 (patch)
treed5d900deb656a5da18e0b60d00f0db73f3a2e88e /files/zh-cn/web/javascript/reference/global_objects/proxy/handler/isextensible
parent8260a606c143e6b55a467edf017a56bdcd6cba7e (diff)
downloadtranslated-content-310fd066e91f454b990372ffa30e803cc8120975.tar.gz
translated-content-310fd066e91f454b990372ffa30e803cc8120975.tar.bz2
translated-content-310fd066e91f454b990372ffa30e803cc8120975.zip
unslug zh-cn: move
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/proxy/handler/isextensible')
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/proxy/handler/isextensible/index.html123
1 files changed, 0 insertions, 123 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/proxy/handler/isextensible/index.html b/files/zh-cn/web/javascript/reference/global_objects/proxy/handler/isextensible/index.html
deleted file mode 100644
index 7be418197f..0000000000
--- a/files/zh-cn/web/javascript/reference/global_objects/proxy/handler/isextensible/index.html
+++ /dev/null
@@ -1,123 +0,0 @@
----
-title: handler.isExtensible()
-slug: Web/JavaScript/Reference/Global_Objects/Proxy/handler/isExtensible
-tags:
- - ECMAScript 2015
- - JavaScript
- - Method
- - Proxy
-translation_of: Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/isExtensible
----
-<div>{{JSRef}}<br>
-<strong>handler.isExtensible() </strong>方法用于拦截对对象的Object.isExtensible()。</div>
-
-<div>
-<p>{{EmbedInteractiveExample("pages/js/proxyhandler-isextensible.html", "taller")}}</p>
-</div>
-
-<h2 id="语法">语法</h2>
-
-<pre class="brush: js">var p = new Proxy(target, {
- isExtensible: function(target) {
- }
-});
-</pre>
-
-<h3 id="参数">参数</h3>
-
-<p>下列参数将会被传递给 <code>isExtensible</code>方法。 this 绑定在 handler 对象上。</p>
-
-<dl>
- <dt><code>target</code></dt>
- <dd>目标对象。</dd>
-</dl>
-
-<h3 id="返回值">返回值</h3>
-
-<p><code>isExtensible</code>方法必须返回一个 Boolean值或可转换成Boolean的值。</p>
-
-<h2 id="描述">描述</h2>
-
-<p>handler.isExtensible()用于拦截对对象的Object.isExtensible()。</p>
-
-<h3 id="拦截">拦截</h3>
-
-<p>该方法会拦截目标对象的以下操作:</p>
-
-<ul>
- <li>{{jsxref("Object.isExtensible()")}}</li>
- <li>{{jsxref("Reflect.isExtensible()")}}</li>
-</ul>
-
-<h3 id="约束">约束</h3>
-
-<p>如果违背了以下的约束,proxy会抛出 TypeError:</p>
-
-<ul>
- <li><code>Object.isExtensible(proxy)</code> 必须同<code>Object.isExtensible(target)</code>返回相同值。也就是必须返回true或者为true的值,返回false和为false的值都会报错。</li>
-</ul>
-
-<h2 id="示例">示例</h2>
-
-<p>以下代码演示{{jsxref("Object.isExtensible()")}}.</p>
-
-<pre class="brush: js">var p = new Proxy({}, {
- isExtensible: function(target) {
- console.log('called');
- return true;//也可以return 1;等表示为true的值
- }
-});
-
-console.log(Object.isExtensible(p)); // "called"
- // true
-</pre>
-
-<p>以下代码演示违反约束的情况。</p>
-
-<pre class="brush: js">var p = new Proxy({}, {
- isExtensible: function(target) {
- return false;//return 0;return NaN等都会报错
- }
-});
-
-Object.isExtensible(p); // TypeError is thrown
-</pre>
-
-<h2 id="规范">规范</h2>
-
-<table class="standard-table">
- <tbody>
- <tr>
- <th scope="col">Specification</th>
- <th scope="col">Status</th>
- <th scope="col">Comment</th>
- </tr>
- <tr>
- <td>{{SpecName('ES2015', '#sec-proxy-object-internal-methods-and-internal-slots-isextensible', '[[IsExtensible]]')}}</td>
- <td>{{Spec2('ES2015')}}</td>
- <td>Initial definition.</td>
- </tr>
- <tr>
- <td>{{SpecName('ESDraft', '#sec-proxy-object-internal-methods-and-internal-slots-isextensible', '[[IsExtensible]]')}}</td>
- <td>{{Spec2('ESDraft')}}</td>
- <td></td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="浏览器兼容性">浏览器兼容性</h2>
-
-<div>
-
-
-<p>{{Compat("javascript.builtins.Proxy.handler.isExtensible")}}</p>
-</div>
-
-<h2 id="另见">另见</h2>
-
-<ul>
- <li>{{jsxref("Proxy")}}</li>
- <li>{{jsxref("Proxy.handler", "handler")}}</li>
- <li>{{jsxref("Object.isExtensible()")}}</li>
- <li>{{jsxref("Reflect.isExtensible()")}}</li>
-</ul>