invoke BeanShell

Discussion in 'Javascript' started by jc, Mar 31, 2005.

  1. jc

    jc Guest

    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
     
    jc, Mar 31, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SOl

    [BEANSHELL] Extends

    SOl, Jul 19, 2003, in forum: Java
    Replies:
    0
    Views:
    399
  2. Wolfgang Groiss
    Replies:
    0
    Views:
    405
    Wolfgang Groiss
    Nov 19, 2003
  3. Michael Pitoniak
    Replies:
    1
    Views:
    564
    Michael Pitoniak
    Dec 20, 2003
  4. vnssoftware
    Replies:
    0
    Views:
    450
    vnssoftware
    Feb 4, 2004
  5. Robert
    Replies:
    0
    Views:
    365
    Robert
    Jul 6, 2004
Loading...

Share This Page