aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/javascript/reference/global_objects/proxy/handler/apply
diff options
context:
space:
mode:
Diffstat (limited to 'files/ko/web/javascript/reference/global_objects/proxy/handler/apply')
-rw-r--r--files/ko/web/javascript/reference/global_objects/proxy/handler/apply/index.html154
1 files changed, 154 insertions, 0 deletions
diff --git a/files/ko/web/javascript/reference/global_objects/proxy/handler/apply/index.html b/files/ko/web/javascript/reference/global_objects/proxy/handler/apply/index.html
new file mode 100644
index 0000000000..b4928da1d8
--- /dev/null
+++ b/files/ko/web/javascript/reference/global_objects/proxy/handler/apply/index.html
@@ -0,0 +1,154 @@
+---
+title: handler.apply()
+slug: Web/JavaScript/Reference/Global_Objects/Proxy/handler/apply
+tags:
+ - apply트랩
+ - 트랩
+ - 프록시
+translation_of: Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/apply
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>handler.apply()</code></strong> 메소드는 함수호출 시를 위한 트랩(trap)이다.</p>
+
+<h2 id="문법">문법</h2>
+
+<pre class="brush: js">var p = new Proxy(target, {
+ apply: function(target, thisArg, argumentsList) {
+ }
+});
+</pre>
+
+<h3 id="인자">인자</h3>
+
+<p>apply 메소드에는 다음과 같은 인자가 들어온다.. <code>this는 </code>handler를 가리킨다.</p>
+
+<dl>
+ <dt><code>target</code></dt>
+ <dd>대상이 되는 객체(함수)</dd>
+ <dt><code>thisArg</code></dt>
+ <dd>호출 시 바인딩 된 this</dd>
+ <dt><code>argumentsList</code></dt>
+ <dd>호출 시 전달된 인자목록.</dd>
+</dl>
+
+<h3 id="반환_값">반환 값</h3>
+
+<p><code>apply</code> 메소드는 어떤 값이든 반환할 수 있다.</p>
+
+<h2 id="설명">설명</h2>
+
+<p><code><strong>handler.apply</strong></code> 메소드는 함수호출 시를 위한 트랩이다.</p>
+
+<h3 id="가로채기">가로채기</h3>
+
+<p>이 트랩은 다음과 같은 것들을 가로챌 수 있다:</p>
+
+<ul>
+ <li><code>proxy(...args)</code></li>
+ <li>{{jsxref("Function.prototype.apply()")}} 와 {{jsxref("Function.prototype.call()")}}</li>
+ <li>{{jsxref("Reflect.apply()")}}</li>
+</ul>
+
+<h3 id="기본(불변)조건">기본(불변)조건</h3>
+
+<p><code>handler.apply</code> 메소드에 대한 특별히 지켜야 할 기본조건은 없다.</p>
+
+<h2 id="예제">예제</h2>
+
+<p>다음의 코드는 함수 호출 시에 트랩을 건다.</p>
+
+<pre class="brush: js">var p = new Proxy(function() {}, {
+ apply: function(target, thisArg, argumentsList) {
+ console.log('호출됨: ' + argumentsList.join(', '));
+ return argumentsList[0] + argumentsList[1] + argumentsList[2];
+ }
+});
+
+console.log(p(1, 2, 3)); // "호출됨: 1, 2, 3"
+ // 6
+</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-call-thisargument-argumentslist', '[[Call]]')}}</td>
+ <td>{{Spec2('ES2015')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-proxy-object-internal-methods-and-internal-slots-call-thisargument-argumentslist', '[[Call]]')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="브라우저별_호환성">브라우저별 호환성</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<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>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoDesktop("18")}}</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>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatGeckoMobile("18")}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="관련_내용">관련 내용</h2>
+
+<ul>
+ <li>{{jsxref("Proxy")}}</li>
+ <li>{{jsxref("Proxy.handler", "handler")}}</li>
+ <li>{{jsxref("Function.prototype.apply")}}</li>
+ <li>{{jsxref("Function.prototype.call")}}</li>
+ <li>{{jsxref("Reflect.apply()")}}</li>
+</ul>