On Mon, Mar 16, 2015 at 11:53 AM, Allen Wirfs-Brock
<[email protected]> 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
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss