I'm currently working on a prototype function called event.
Prototype
Func("input_element_id").event("keyup",function(){
alert("Works on keyup in an Input!");
}
Func.prototype= {
keyup: function(func){
//adding event listener and callback using func
},
event: function(e,func) {
//what to do here to call function "keyup"
}
};
The prototype name is stored in the variable e
. Now, I'm trying to figure out how to call that particular function
using the variable name.
I am experimenting with this approach in order to allow passing "keyup keydown" as arguments to add keyup and keydown listeners simultaneously, instead of calling each prototype function individually.
Your insights would be greatly appreciated. Thanks!