Permalink
Browse files

added note on function calls

  • Loading branch information...
tvcutsem committed Aug 3, 2012
1 parent c11168d commit 4020ac40478dbb3b862bc089380ff8de34679a10
Showing with 1 addition and 1 deletion.
  1. +1 −1 doc/traps.md
View
@@ -195,7 +195,7 @@ try {
* (1): in Javascript, a method call like `obj.foo(1,2,3)` is defined as looking up the "foo" property on `obj`, and then calling the resulting function with `obj` as the `this`-binding. If `obj` is a proxy, the same strategy applies. There is no separate `invoke` trap.
* (2): the `for-of` statement is forthcoming in ECMAScript 6.
- * (3): the syntax `...args` is ECMAScript 6 syntax for "spreading" arguments into a call. `f(...[1,2,3])` is equivalent to `f(1,2,3)`.
+ * (3): the syntax `...args` is ECMAScript 6 syntax for "spreading" arguments into a call. `f(...[1,2,3])` is equivalent to `f(1,2,3)`. Function calls can only be intercepted if the target is a function, i.e. `typeof target === "function"`.
* (4): this assumes that the proxy was installed as a method on `object`, e.g. `var object = { proxy: Proxy(target, handler) }`.
* (5): assuming that `proxy.call`, which triggers the proxy's "get" trap, returned `Function.prototype.call`.
* (6): assuming that `proxy.hasOwnProperty`, which triggers the proxy's "get" trap, returned `Object.prototype.hasOwnProperty`.

0 comments on commit 4020ac4

Please sign in to comment.