Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

How to bridge Java object and Javascript with RingoJS?

40 views
Skip to first unread message

Xybrek Zybrek

unread,
Oct 3, 2018, 1:46:29 AM10/3/18
to RingoJS
Can we use RingoJS and pass Java objects into Javascript just like what we can do with Rhino, 

Context cx = Context.enter();
        ScriptableObject scope = cx.initStandardObjects();
        ScriptableObject.putProperty(scope, "javaObject", javaObject);
        cx.evaluateString(scope,
                String.format("function onRequest() { %s }", expression),
                "<func>", 1, null);


Whereas, the Javascript expression would be able to access the javaObject from within the Javascript code.
Also, how to translate this code to RingoJS code? 


Philipp Naderer

unread,
Oct 3, 2018, 3:41:10 AM10/3/18
to rin...@googlegroups.com
Take a look at RingoRunner, which is the class bootstraping everything before a script gets executed:

Also RingoShell is a good starting point:

The shell executes command by command reading from stdin.

Bye
Philipp

--
You received this message because you are subscribed to the Google Groups "RingoJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ringojs+u...@googlegroups.com.
To post to this group, send email to rin...@googlegroups.com.
Visit this group at https://groups.google.com/group/ringojs.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages