Accessing a Javascript prototype function -
i have prototype function such event.
prototype
func("input_element_id").event("keyup",function(){ alert("works on keyup in input!"); } func.prototype= { keyup: function(func){ //adding event listener , callback using func }, event: function(e,func) { //what here call function "keyup" } };
the prototype name in variable e
. how can call function
using variable name?
i doing this, passing "keyup keydown" add keyup , keydown listeners, better calling each prototype function individually.
thanks.
var func = function(element){ this.element = element; }; func.prototype = { keyup: function(handler){ this.element.onkeyup = handler; }, event: function(e,handler){ switch(e){ case 'keyup': return this.keyup(handler); break; } } }
Comments
Post a Comment