eclipsesource / eclipsesource/J2V8
Java CallBack for JS Getter and Setter
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 387
- PR merge metrics
- No merged PRs in 30d
Description
In the [Registering Java Callbacks with J2V8](https://eclipsesource.com/blogs/2015/06/06/registering-java-callbacks-with-j2v8/) I have found a way to invoke Java code when JS function is called. Is there any way in J2V8 how the same could be done for JS [Getter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get) or [Setter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set). The reason behind this is migrating exiting Rhino scripts, which can do the same using `@JSGetter` or `@JSSetter` annotations on methods.
I will try to work-around this issue by "injecting extra script" _(see below)_, but it would be nice to have this ability right in the lib
```.JS
Object.defineProperty(o, 'b', { set: function(x) { this.a = x / 2; } });
```
Contributor guide
Assessment
This issue has not been assessed yet.