Proxies traps receiver

Sat Sep 17 09:03:01 PDT 2011


On this webpage:
They show this:

  has:       function(name) -> boolean                  // name in proxy
  hasOwn:    function(name) -> boolean                  //
({}), name)
  get:       function(receiver, name) -> any            //
  set:       function(receiver, name, val) -> boolean   // = val
  enumerate: function() -> [string]                     // for (name
in proxy) (return array of enumerable own and inherited properties)
  keys:      function() -> [string]                     //
Object.keys(proxy)  (return array of enumerable own properties only)

How come the get and set traps get a receiver argument when the others don't?

I mean the only aim of having a receiver argument is to be able to use
the same "traps"object for several proxies and in fact, you can for
get and set traps. But it won't work on has, hasOwn and so on...

What's the reason for that?

Thank you in advance.

More information about the es-discuss mailing list