Re:Metaprogramming with ECMAScript 6 proxies
by AnkhMorporkian on Tuesday December 09, 2014 @03:45PM
(#8725591)
This is huge.
var proto = new Proxy({}, {
get(target, propertyKey, receiver) {
console.log('GET '+propertyKey);
return target[propertyKey];
}});
I've been following ES6 pretty closely, but somehow I missed this huge feature. Don't get me wrong, I love generators and destructuring, but this is soooo cool.
Re:Metaprogramming with ECMAScript 6 proxies
by rauschma on Thursday December 11, 2014 @12:16PM
(#8735883)
Not completely: with getters, you have to decide on a specific set of properties, the proxy GET trap intercepts all get operations. But I agree that you don’t always need proxies.