I am trying to implement Revealing Module Pattern. I need to assign an event handler to one of elements, this event handler is a function I define in protoype but I get this.trigger is not a function error.
Here's what I have done:
//constructor
var MyClass = function (settings) {
this.someElement=$(settings.elementID);
}
//prototype
MyClass.prototype = function() {
var init = function() {
this.someElement.change(this.handler);
},
handler = function() {
this.someElement.hide();
};
return {
init : init,
handler : handler
};
}();
Here's how I call it:
var myClass = new MyClass();
myClass.init();