Afternoon one and all.

I have been using Rhino now and I have to say, loving it.   I am doing
something rather special with it, and would like to the expert advice
of the group here to see if i am going down the right road.

Assume this Javascript snippet.

--- my js ---
x = $myscope.GetTime();
y = $myscope.trim( "  alan   " );
----------------

--- java snippet -----
Object jsOut = Context.javaToJS( new FunctionBridge(), scope);
ScriptableObject.putProperty(scope, "$myscope", jsOut);
----------------

Right, the easiest thing i can do is to define "GetTime" / "trim" as
Java objects in my _FunctionBridge_ class, and then all is well in the
world and the Javascript engine can call those methods.

However what i want to do is __NOT__ define those methods in advance,
as in my particular application, they will be dynamic (and
plentiful).  So I want the engine to instead call the following method
from _FunctionBridge_ run( String funcName, Object args[] )

I have successfully achieved this, by modifying,
org.mozilla.javascript.optimizer.OptRuntime, but it only works for
functions that have no arguments.  I do this by checking for my object
type, and then rewrapping the original call to the use the run()
method.  Works like a charm.

When I try to catch the execution for functions that have arguments, I
can't seem to get a handle on this at anytime.

Can anyone give me some pointers as to where I should be looking to
achieve this?

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

Reply via email to