I am new to object oriented js. In my work, i have to edit some previous code done by some other person. AS i am new to this area, can not understand some structure and notation. Bellow the structure that i can not deal with,
(function ($) {
AjaxSolr.GenericGraphWidget = AjaxSolr.AbstractFacetWidget.extend({
_functionName:function(){
}
})(jQuery);
Now here AjaxSolr
is a base class which is defined in another file. AbstractFacetWidget
is also a class which is also extended from AjaxSolr
. Now can anybody explain, what kind of structure is this?(ya, i understand only that this is a kind of class, like other oop language, which is extended from another class). what (function ($)
means?
What i know untill now that to create object and inheritance i have to do like the following-
var Constructor = function(name) {
this.name = name
};
Constructor.prototype.mymethod = function() {
alert("my name is : " + this.name);
};
var obj = new Constructor("foo");
obj.mymethod();
May be they used another format that i don't know. If ,I want to call a function of that class from outside of that class, how can i do this? If my question does not explain well, please ask me.