mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-12-16 07:51:52 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -6,10 +6,10 @@
|
||||
<p><img alt="WeakMap(no clear() any more).png" src="https://mdn.mozillademos.org/files/15608/WeakMap(no%20clear()%20any%20more).png" style="height: 490px; width: 735px;"/></p>
|
||||
</div>
|
||||
<h2 id="语法">语法</h2>
|
||||
<pre class="syntaxbox"><em>wm</em>.clear();</pre>
|
||||
<pre><code class="language-javascript"><em>wm</em>.clear();</code></pre>
|
||||
<h2 id="示例">示例</h2>
|
||||
<h3 id="使用_clear_方法">使用 <code>clear</code> 方法</h3>
|
||||
<pre class="brush: js;highlight:[10] example-bad">var wm = new WeakMap();
|
||||
<pre><code class="language-js;highlight:[10] example-bad">var wm = new WeakMap();
|
||||
var obj = {};
|
||||
|
||||
wm.set(obj, "foo");
|
||||
@@ -22,7 +22,7 @@ wm.clear();
|
||||
|
||||
wm.has(obj) // false
|
||||
wm.has(window) // false
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<p>当前版本或者起草中没有这个方法,这个方法在版本 28(2014 年 10 月 14) 之前是 ECMAScript 6 起草规范的一部分,但是在起草之后的版本中被移除了。它不在是最终标准的一部分了 。</p>
|
||||
<h2 id="浏览器兼容性">浏览器兼容性</h2>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<h2 id="Summary" name="Summary">概述</h2>
|
||||
<p><code><strong>delete()</strong></code> 方法可以从一个 <code>WeakMap</code> 对象中删除指定的元素。</p>
|
||||
<h2 id="Syntax" name="Syntax">语法</h2>
|
||||
<pre class="syntaxbox"><code><em>wm</em>.delete(key);</code></pre>
|
||||
<pre><code class="language-javascript"><code><em>wm</em>.delete(key);</code></code></pre>
|
||||
<h3 id="Parameters参数">Parameters参数</h3>
|
||||
<dl>
|
||||
<dt>key</dt>
|
||||
@@ -12,13 +12,13 @@
|
||||
<h3 id="返回值">返回值</h3>
|
||||
<p>如果成功删除,返回 <code>true</code>,否则返回 <code>false</code>。</p>
|
||||
<h2 id="Examples" name="Examples">示例</h2>
|
||||
<pre class="brush: js;">var wm = new WeakMap();
|
||||
<pre><code class="language-js;">var wm = new WeakMap();
|
||||
wm.set(window, "foo");
|
||||
|
||||
wm.delete(window); // 返回 true,表示删除成功。
|
||||
|
||||
wm.has(window); // 返回 false,因为 window 对象已经被删除了。
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div></div>
|
||||
<p><code><strong>get()</strong></code> 方法返回 <code>WeakMap</code> 指定的元素。</p>
|
||||
<h2 id="语法">语法</h2>
|
||||
<pre class="syntaxbox"><code><em>wm</em>.get(key);</code></pre>
|
||||
<pre><code class="language-javascript"><code><em>wm</em>.get(key);</code></code></pre>
|
||||
<h3 id="参数">参数</h3>
|
||||
<dl>
|
||||
<dt>key</dt>
|
||||
@@ -12,12 +12,12 @@
|
||||
<h3 id="返回与指定键相关联的值,如果_WeakMap_对象找不到这个键则返回_undefined。"><span style="font-size: 14px; line-height: 1.5;">返回与指定键相关联的值,如果 </span><code style="font-size: 14px; font-style: normal; font-weight: normal; line-height: 1.5;">WeakMap</code><span style="font-size: 14px; line-height: 1.5;"> 对象找不到这个键则返回 </span><code style="font-size: 14px; font-style: normal; font-weight: normal; line-height: 1.5;">undefined</code><span style="font-size: 14px; line-height: 1.5;">。</span></h3>
|
||||
<h2 id="例子">例子</h2>
|
||||
<h3 id="使用_get_方法">使用 <code>get </code>方法<code> </code></h3>
|
||||
<pre class="brush: js">var wm = new WeakMap();
|
||||
<pre><code class="language-javascript">var wm = new WeakMap();
|
||||
wm.set(window, "foo");
|
||||
|
||||
wm.get(window); // 返回 "foo".
|
||||
wm.get("baz"); // 返回 undefined.
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div></div>
|
||||
<p> <code><strong>has()</strong></code> 方法根据WeakMap对象的元素中是否存在key键返回一个boolean值。</p>
|
||||
<h2 id="语法">语法</h2>
|
||||
<pre class="syntaxbox"><code><em>wm</em>.has(key);</code></pre>
|
||||
<pre><code class="language-javascript"><code><em>wm</em>.has(key);</code></code></pre>
|
||||
<h3 id="Parameters">Parameters</h3>
|
||||
<dl>
|
||||
<dt>key</dt>
|
||||
@@ -15,12 +15,12 @@
|
||||
</dl>
|
||||
<h2 id="例子">例子</h2>
|
||||
<h3 id="使用_has方法">使用 <code>has方法</code></h3>
|
||||
<pre class="brush: js">var wm = new WeakMap();
|
||||
<pre><code class="language-javascript">var wm = new WeakMap();
|
||||
wm.set(window, "foo");
|
||||
|
||||
wm.has(window); // returns true
|
||||
wm.has("baz"); // returns false
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<h2 id="描述">描述</h2>
|
||||
<p><a href="Reference/WeakMap" title="此页面仍未被本地化, 期待您的翻译!"><code>WeakMap</code></a> 实例从 <a href="Reference/Global_Objects/WeakMap/prototype" title="WeakMap.prototype属性表现为 WeakMap的构造器。"><code>WeakMap.prototype</code></a>继承了所有属性。你可以在<code>WeakMap构造器中添加属性和方法,从而使得所有</code>实例中都有效。</p>
|
||||
<p><code>WeakMap.prototype</code> 本身只是一个普通的对象:</p>
|
||||
<pre class="brush: js">Object.prototype.toString.call(WeakMap.prototype); // "[object Object]"</pre>
|
||||
<pre><code class="language-javascript">Object.prototype.toString.call(WeakMap.prototype); // "[object Object]"</code></pre>
|
||||
<h2 id="属性">属性</h2>
|
||||
<dl>
|
||||
<dt><code>WeakMap.prototype.constructor</code></dt>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div></div>
|
||||
<p><code><strong>set()</strong></code> 方法根据指定的<code>key和</code><code>value在</code> <code>WeakMap对象中添加新/更新元素。</code></p>
|
||||
<h2 id="语法">语法</h2>
|
||||
<pre class="syntaxbox"><code><em>wm</em>.set(key, value);</code></pre>
|
||||
<pre><code class="language-javascript"><code><em>wm</em>.set(key, value);</code></code></pre>
|
||||
<h3 id="参数">参数</h3>
|
||||
<dl>
|
||||
<dt>key</dt>
|
||||
@@ -14,7 +14,7 @@
|
||||
<p><code>该WeakMap对象</code></p>
|
||||
<h2 id="例子">例子</h2>
|
||||
<h3 id="使用set方法"><code>使用set方法</code></h3>
|
||||
<pre class="brush: js">var wm = new WeakMap();
|
||||
<pre><code class="language-javascript">var wm = new WeakMap();
|
||||
var obj = {};
|
||||
|
||||
// Add new elements to the WeakMap
|
||||
@@ -22,7 +22,7 @@ wm.set(obj, "foo").set(window, "bar"); // chainable
|
||||
|
||||
// Update an element in the WeakMap
|
||||
wm.set(obj, "baz");
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user