Organizational Research By

Surprising Reserch Topic

Experts Most Trusted Topic


is there an equivalent of the nosuchmethod feature for properties or a way


is there an equivalent of the nosuchmethod feature for properties or a way  using -'javascript'

There is a noSuchMethod feature in some javascript implementations (Rhino, SpiderMonkey)

proxy = {
    __noSuchMethod__: function(methodName, args){
        return "The " + methodName + " method isn't implemented yet. HINT: I accept cash and beer bribes" ;
    },

    realMethod: function(){
     return "implemented" ;   
    }
}

js> proxy.realMethod()
implemented
js> proxy.newIPod()
The newIPod method isn't implemented yet. HINT: I accept cash and beer bribes
js>


I was wondering, is there was a way to do something similar for properties? I'd like to write proxy classes that can dispatch on properties as well as methods.
    

asked Sep 8, 2015 by rajesh
0 votes
11 views



Related Hot Questions



Walkin Jobs Opening



Government Jobs Opening


...