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: Why does my switch need to be wired in this fashion?
Answer: Read the data sheet before you start connecting to something. Your assumption that because there are nine terminals and four switches that 'each switch has two terminals' is unfounded.

The 9 terminals are 8 input channels and ground. As the text you quoted says, the switches are connected between the first four channels and ground, so the connection in your photo agrees with the schematic.