I'm developing a small framework (in JS) and for esthetic reasons and simplicity I was wondering if there could be a way to implement something like PHP "__invoke".

For example:

var myClass = function(config) {
    this.config = config;
    this.method = function(){};
    this.execute = function() {
        return this.method.apply(this, arguments);
    }
}
var execCustom = new myClass({ wait: 100 });
execCustom.method = function() {
    console.log("called method with "+arguments.length+" argument(s):");
    for(var a in arguments) console.log(arguments[a]);
    return true;
};
execCustom.execute("someval","other");  


Desired way to execute:

execCustom("someval","other");


Any ideas? Thanks.


Question: Setting initial value in a Kendo UI Cascading Combobox with server filtering
Answer: You can set the text property of the comboBox.
    .Text(Model.SelectedDealer)