Native Proxy Syntax
Vihan Bhargava
contact at vihan.org
Wed Aug 23 15:08:21 UTC 2017
The `Proxy` class is great for classes however at the moment, the current syntax can be unwieldy:
```
class MyClass {
constructor() {
return new Proxy(this, {
get: function(target, name) {
if (name in target) return target[name];
// ... do something to determine property
}
});
}
}
```
My proposal is to introduce a more idiomatic syntax for proxies in classes:
```
class MyClass {
constructor () { ... }
get *(name) {
// ... do something to determine property
}
}
```
This already is much more clear than the above.
More information about the es-discuss
mailing list