Is there a way to get all method calls on an object to be passed to a function that gets the function name as a string and the arguments as an array passed to it.
E.g, in pseudo code:
function DynamicFunctions() {
this.tryCall = function(functionName, arguments) {
if(functionName == "dynamic1") { console.log( "Function dynamic1" )
else { console.log("A different function");
}
The usage is:
var obj = new DynamicFunctions();
obj.dynamic1();
obj.somethingElse();
The output in that case would be:
Function dynamic1
A different function