Reflect.getOwnPropertySymbols?

Keith Cirkel esdiscuss at keithcirkel.co.uk
Tue Mar 17 10:45:46 UTC 2015


Thanks Allen and Jason! This completely cleared it all up for me!

On 16 March 2015 at 18:15, Jason Orendorff <jason.orendorff at gmail.com>
wrote:

> On Mon, Mar 16, 2015 at 11:53 AM, Allen Wirfs-Brock
> <allen at wirfs-brock.com> wrote:
> > In ES6, the primary role of the Reflect object is to provide direct
> access
> > to an object's essential internal methods:
> >
> http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object-internal-methods-and-internal-slots
>
> To further elaborate on this: one way this is useful is that the 14
> essential internal methods are exactly the operations you can trap
> with a custom Proxy. It's useful, when writing a Proxy, to use the
> Reflect methods as fallbacks:
>
>     var alertingProxy = new Proxy(obj, {
>         // Proxy: hook into property assignment
>         set(t, key, value, receiver) {
>             alert(`setting the ${key} property of ${t} to ${value}`);
>
>             // Reflect: do normal property assignment
>             return Reflect.set(t, key, value, receiver);
>         }
>     });
>
> -j
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150317/38228a91/attachment.html>


More information about the es-discuss mailing list