mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-12-18 00:44:36 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -4,11 +4,11 @@
|
||||
<div><iframe class="interactive interactive-js taller" frameborder="0" height="250" src="https://interactive-examples.mdn.mozilla.net/pages/js/proxyhandler-apply.html" width="100%"></iframe></div>
|
||||
<p class="hidden">此交互式示例的源代码存储在GitHub存储库中。 如果您想为交互式示例项目做出贡献,请克隆 <a class="external" href="https://github.com/mdn/interactive-examples" rel="noopener">https://github.com/mdn/interactive-examples</a> 并向我们发起拉取请求</p>
|
||||
<h2 id="语法">语法</h2>
|
||||
<pre class="brush: js">var p = new Proxy(target, {
|
||||
<pre><code class="language-javascript">var p = new Proxy(target, {
|
||||
apply: function(target, thisArg, argumentsList) {
|
||||
}
|
||||
});
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h3 id="参数">参数</h3>
|
||||
<p>以下是传递给apply方法的参数,<code>this上下文绑定在</code>handler对象上.</p>
|
||||
<dl>
|
||||
@@ -35,7 +35,7 @@
|
||||
<p><code>target</code>必须是可被调用的。也就是说,它必须是一个函数对象。</p>
|
||||
<h2 id="示例">示例</h2>
|
||||
<p>以下代码演示如何捕获函数的调用。</p>
|
||||
<pre class="brush: js">var p = new Proxy(function() {}, {
|
||||
<pre><code class="language-javascript">var p = new Proxy(function() {}, {
|
||||
apply: function(target, thisArg, argumentsList) {
|
||||
console.log('called: ' + argumentsList.join(', '));
|
||||
return argumentsList[0] + argumentsList[1] + argumentsList[2];
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
console.log(p(1, 2, 3)); // "called: 1, 2, 3"
|
||||
// 6
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user