This is an addon plugin for Cla6.js class system library which lets you do super calls. Although originally designed for use with Node.js and installable via npm install cla6-base
, it can also be used directly in the browser.
Cla6 Base is also installable via:
- bower:
bower install cla6-base
var Parent = Cla6('Parent', {
constructor: function() {
this.foo = 'foo';
},
method: function() {
this.baz = 'baz';
},
});
var Child = Cla6('Child').extend(Parent, {
constructor: function() {
Cla6.base();
this.bar = 'bar';
},
method: function() {
Cla6.base();
this.qux = 'qux';
},
log: function() {
console.log(this.foo, this.bar, this.baz, this.qux);
}
});
var obj = new Child();
obj.method();
obj.log(); // foo bar baz qux
Note, base can only be used directly from method scope, not inner scopes or outer scopes.
var Cla6 = require('cla6');
var Cla6Base = require('cla6-base');
Cla6.use(Cla6Base);
The source is available for download from
GitHub.
Alternatively, you can install using Node Package Manager (npm
):
npm install cla6-base