Private Slots

Kevin Smith khs4473 at gmail.com
Mon Jan 14 18:22:03 PST 2013


This is one thing that came to my mind a couple months ago, but there are a
> number of ways to resolve this problem, such as:
>
>     function mixin(a, b) {
>         for (let name of Object.getOwnPropertyNames(b)) {
>             let desc = Object.getOwnPropertyDescriptor(b, name);
>             if (typeof desc.value == 'function')
>                 desc.value = desc.value.bind(b);
>             Object.defineProperty(a, name, desc);
>         }
>     }
>
>
In order to satisfy security guarantees, properties which are keys on
private symbols are not returned by getOwnPropertyNames.

{ Kevin }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130114/1c34de3d/attachment.html>


More information about the es-discuss mailing list