On Jul 24, 5:29 pm, Ivan Voras <[EMAIL PROTECTED]> wrote:
> On Jul 22, 4:06 pm, Charles Lowell <[EMAIL PROTECTED]> wrote:
>
> > I would look at the org.mozilla.javascript.tools.shell.Global class as
> > an example of this: specifically the defineFunctionProperties()
> > method.
>
> Thanks, this seems like it would works.
>
> Another question: what exceptions can I raise from the Java function
> called from JavaScript? In other words: how to signal errors such as
> wrong number of arguments, etc.?

For an example of defining global functions, take a look at
http://mxr.mozilla.org/mozilla/source/js/rhino/testsrc/org/mozilla/javascript/tests/DefineFunctionPropertiesTest.java.

As far as exceptions, you can throw any Java exception and it will be
exposed to the script as a Java exception.

--N
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to