}
public Object call(Context ctx, Scriptable scope,
Scriptable thisObj, Object[] args)
throws JavaScriptException {
NativeJavaObject njo = (NativeJavaObject)thisObj;
if (args[1] instanceof Function) {
EventListener evtListener = new FunctionEventListener
((Function)args[1],
((RhinoInterpreter.ExtendedContext)ctx).getInterpreter());
listenerMap.put(args[1], new SoftReference(evtListener));
// we need to marshall args
Class[] paramTypes = { String.class, Function.class,
Boolean.TYPE };
for (int i = 0; i < args.length; i++)
args[i] = Context.toType(args[i], paramTypes[i]);
((EventTarget)njo.unwrap()).addEventListener
((String)args[0], evtListener,
((Boolean)args[2]).booleanValue());
return Undefined.instance;
}
if (args[1] instanceof NativeObject) {
EventListener evtListener =
new HandleEventListener((Scriptable)args[1],
((RhinoInterpreter.ExtendedContext)
ctx).getInterpreter());
listenerMap.put(args[1], new SoftReference(evtListener));
// we need to marshall args
Class[] paramTypes = { String.class, Scriptable.class,
Boolean.TYPE };
for (int i = 0; i < args.length; i++)
args[i] = Context.toType(args[i], paramTypes[i]);
((EventTarget)njo.unwrap()).addEventListener
((String)args[0], evtListener,
((Boolean)args[2]).booleanValue());
return Undefined.instance;
}
return delegate.call(ctx, scope, thisObj, args);