I often see the following syntax in libraries, but then no inheritance. Now how can I define an ObjB that is inherited from ObjA and adds its own variables and methods?
(function() {
'use strict';
var ObjA = function(o) {
var self = this;
self.init(o);
};
ObjA.prototype = {
init: function(o) {
var self = this;
self._x = o.x || false;
self._y = o.y || false;
return self;
}
// More methods...
}
if (typeof global !== 'undefined') {
global.ObjA = ObjA;
}
else if (typeof window !== 'undefined') {
window.ObjA = ObjA;
}
})();