mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2026-02-28 01:58:28 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<article id="wikiArticle">
|
||||
<div>handler.isExtensible()用于拦截对对象的Object.isExtensible()。</div>
|
||||
<h2 id="语法">语法</h2>
|
||||
<pre class="brush: js">var p = new Proxy(target, {
|
||||
<pre><code class="language-javascript">var p = new Proxy(target, {
|
||||
isExtensible: function(target) {
|
||||
}
|
||||
});
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h3 id="参数">参数</h3>
|
||||
<p>下列参数将会被传递给 <code>isExtensible</code>方法。 this 绑定在 handler 对象上。</p>
|
||||
<dl>
|
||||
@@ -29,7 +29,7 @@
|
||||
</ul>
|
||||
<h2 id="示例">示例</h2>
|
||||
<p>以下代码演示<a href="Reference/Global_Objects/Object/isExtensible" title="Object.isExtensible() 方法判断一个对象是否是可扩展的(是否可以在它上面添加新的属性)。"><code>Object.isExtensible()</code></a>.</p>
|
||||
<pre class="brush: js">var p = new Proxy({}, {
|
||||
<pre><code class="language-javascript">var p = new Proxy({}, {
|
||||
isExtensible: function(target) {
|
||||
console.log('called');
|
||||
return true;//也可以return 1;等表示为true的值
|
||||
@@ -38,16 +38,16 @@
|
||||
|
||||
console.log(Object.isExtensible(p)); // "called"
|
||||
// true
|
||||
</pre>
|
||||
</code></pre>
|
||||
<p>以下代码演示违反约束的情况。</p>
|
||||
<pre class="brush: js">var p = new Proxy({}, {
|
||||
<pre><code class="language-javascript">var p = new Proxy({}, {
|
||||
isExtensible: function(target) {
|
||||
return false;//return 0;return NaN等都会报错
|
||||
}
|
||||
});
|
||||
|
||||
Object.isExtensible(p); // TypeError is thrown
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user