Calling Javascript functions running inside Rhino from Java is easy enough - that after all is why Rhino was created. The thing I am having trouble establishing is this:
- Context: I have a Phonegap CLI (v 6.3.3) Android project (API 19+) where I do a great deal of processing via loadable JavaScript running inside rhino
- A Phonegap plugin - which I am creating at the same time as the actual Phonegap app - contains class called
Storage
which provides public, static, methods such asreadFromFile(String fileName)
,writeToFile(String fileName,String data)
etc. - What I want to be able to do is to call
Storage.readFromFile
etc from my loaded JavaScript code in Rhino.
Just how this should be done is not too clear to me. From the searches I have done thus far it involves using ScriptableObject.putProperty
to pass the Java class in question, Storage
in my case to JavaScript. However, how this should be done and then how it should be used at the JS end leaves me rather confused.
I would be most grateful to anyone here who might be able to point me in the right direction