JavaScript does not specify a strict model for object oriented programming in the way that other languages you may be familiar with, like C++, Java, and Python do. Instead, JavaScript provides a suite of flexible tools from which you can do many different styles of OO as best suited for your particular application. Many parts of Conkeror are structured in a classical OO paradigm. This article describes the conventions that we adhere to in those parts of Conkeror.
function foo () {
// base class initialization
}
foo.prototype = {
constructor: foo,
destroy: function () {}
};
function bar () {
foo.call(this);
// derived class initialization
}
bar.prototype = {
constructor: bar,
__proto__: foo.prototype,
destroy: function () {
// derived class destruction
foo.prototype.destroy.call(this);
}
};