aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/conflicting/web/javascript/reference/global_objects/weakmap/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/conflicting/web/javascript/reference/global_objects/weakmap/index.html')
-rw-r--r--files/zh-cn/conflicting/web/javascript/reference/global_objects/weakmap/index.html138
1 files changed, 138 insertions, 0 deletions
diff --git a/files/zh-cn/conflicting/web/javascript/reference/global_objects/weakmap/index.html b/files/zh-cn/conflicting/web/javascript/reference/global_objects/weakmap/index.html
new file mode 100644
index 0000000000..27f1ff412a
--- /dev/null
+++ b/files/zh-cn/conflicting/web/javascript/reference/global_objects/weakmap/index.html
@@ -0,0 +1,138 @@
+---
+title: WeakMap.prototype
+slug: Web/JavaScript/Reference/Global_Objects/WeakMap/prototype
+translation_of: Web/JavaScript/Reference/Global_Objects/WeakMap
+translation_of_original: Web/JavaScript/Reference/Global_Objects/WeakMap/prototype
+---
+<div>{{JSRef}}</div>
+
+<p><code><strong>WeakMap</strong></code><strong><code>.prototype</code></strong>属性表现为 {{jsxref("WeakMap")}}的构造器。</p>
+
+<div>{{js_property_attributes(0,0,0)}}</div>
+
+<h2 id="描述">描述</h2>
+
+<p>{{jsxref("WeakMap")}} 实例从 {{jsxref("WeakMap.prototype")}}继承了所有属性。你可以在<code>WeakMap构造器中添加属性和方法,从而使得所有</code>实例中都有效。</p>
+
+<p><code>WeakMap.prototype</code> 本身只是一个普通的对象:</p>
+
+<pre class="brush: js">Object.prototype.toString.call(WeakMap.prototype); // "[object Object]"</pre>
+
+<h2 id="属性">属性</h2>
+
+<dl>
+ <dt><code>WeakMap.prototype.constructor</code></dt>
+ <dd>返回创建WeakMap实例的原型函数。 {{jsxref("WeakMap")}}函数是默认的。</dd>
+</dl>
+
+<h2 id="方法">方法</h2>
+
+<dl>
+ <dt>{{jsxref("WeakMap.delete", "WeakMap.prototype.delete(key)")}}</dt>
+ <dd>移除key的关联对象。执行后 <code>WeakMap.prototype.has(key)返回</code><code>false。</code></dd>
+ <dt>{{jsxref("WeakMap.get", "WeakMap.prototype.get(key)")}}</dt>
+ <dd>返回<code>key关联对象</code>, 或者 <code>undefined</code>(没有key关联对象时)。</dd>
+ <dt>{{jsxref("WeakMap.has", "WeakMap.prototype.has(key)")}}</dt>
+ <dd>根据是否有key关联对象返回一个Boolean值。</dd>
+ <dt>{{jsxref("WeakMap.set", "WeakMap.prototype.set(key, value)")}}</dt>
+ <dd>在WeakMap中设置一组key关联对象,返回这个 <code>WeakMap</code>对象。</dd>
+ <dt><s class="obsoleteElement">{{jsxref("WeakMap.prototype.clear()")}} {{obsolete_inline}}</s></dt>
+ <dd><s class="obsoleteElement">从<code>WeakMap中移除所有的</code> key/value 。 注意,该方法已弃用,但可以通过创建一个空的WeakMap并替换原对象来实现 (参看 {{jsxref("WeakMap")}}的后半部分)</s></dd>
+</dl>
+
+<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('ES6', '#sec-weakmap.prototype', 'WeakMap.prototype')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-weakmap.prototype', 'WeakMap.prototype')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容">浏览器兼容</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<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>36</td>
+ <td>{{CompatGeckoDesktop("6.0")}}</td>
+ <td>11</td>
+ <td>23</td>
+ <td>7.1</td>
+ </tr>
+ <tr>
+ <td>Ordinary object</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoDesktop("40")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</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>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatGeckoMobile("6.0")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>8</td>
+ </tr>
+ <tr>
+ <td>Ordinary object</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoMobile("40")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="另请参阅">另请参阅</h2>
+
+<ul>
+ <li>{{jsxref("Map.prototype")}}</li>
+</ul>