J
jc
Hello,
I want to be able to handle any operation done on a javascript object
regardless of where the operation exists or not. I want to handle all
operations on a given object myself. In BeanShell I can do this since
they offer the invoke operation which catches all calls not
implemented by my objects. Is there a way to do this in JavaScript and
in perticular with Rhino?
This is what I can do in BeanShell:
Test() {
invoke(name, args) {
print("you called: " + name);
}
return this;
}
var test = Test();
test.fooBar();
eris:~/tmp > bsh test.bsh
you called: fooBar
Can something similar be done in JS? Could this be done in Rhino? If
not could I modify Rhino's source code and be able to achieve this
somehow?
Thanks
Jean-Claude
I want to be able to handle any operation done on a javascript object
regardless of where the operation exists or not. I want to handle all
operations on a given object myself. In BeanShell I can do this since
they offer the invoke operation which catches all calls not
implemented by my objects. Is there a way to do this in JavaScript and
in perticular with Rhino?
This is what I can do in BeanShell:
Test() {
invoke(name, args) {
print("you called: " + name);
}
return this;
}
var test = Test();
test.fooBar();
eris:~/tmp > bsh test.bsh
you called: fooBar
Can something similar be done in JS? Could this be done in Rhino? If
not could I modify Rhino's source code and be able to achieve this
somehow?
Thanks
Jean-Claude