I use the jQuery extend function to extend a class prototype.
For example:
MyWidget = function(name_var) {
this.init(name_var);
}
$.extend(MyWidge
Why not just use the simple OOP that JavaScript itself provides...long before jQuery?
var myClass = function(){};
myClass.prototype = {
some_property: null,
some_other_property: 0,
doSomething: function(msg) {
this.some_property = msg;
alert(this.some_property);
}
};
Then you just create an instance of the class:
var myClassObject = new myClass();
myClassObject.doSomething("Hello Worlds");
Simple!