-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
J2V8: creating new instance of binded object from JS #338
Comments
You might consider looking at the features in PR #201.
Depending on the results of the PR, these features will be implemented in a
separate github project or added to J2V8 in an upcoming release.
|
@mizumi thanks a lot for such a quick answer! You've committed great addition to the project. After some testing, few questions have appeared, though.
|
No problem; glad you like it!
|
|
|
Cool news! Hope, you'll share your improvements with the community. The essential new feature will be auto binding of the class properties to js and additional annotation of properties and methods to bind. I've invented this features in our project, but, you're definitely more competent of how to do this the right way. Thanks for your answers and time! |
Our teams is currently under consideration of witch Javascript Engine Bridge to use. We are choosing between J2V8 and LiquidCore.
Supposedly, I have to create several instances of some java class in javascript, how can one achieve this in J2V8 using standard instantiation annotation (new ClassName())? In liquidcore you can bind some class, that extends JSFuction, with super constructor:
JSFunction(JSContext ctx, final String methodName, final Class<?extends JSObject> instanceClass)
and register property with desired class name like this:
jsBaseContext.getJsContext().property("WebSocket", this);
and then on calling:
var x = new WebSocket();
java method methodName will fire, where we'll get new instanceClass as JSValue object as parameter, already binded and ready to use in javascript.
The text was updated successfully, but these errors were encountered: