decl
v0.2.3
Published
A class declaration module, that improves code structure and modularization.
Downloads
3
Maintainers
Readme
Install
$ npm install decl
How to use
var cls = require('decl')({
extend: ParentCls,
constructor: function MyClass(arg1, arg2) {
this.super('constructor', arg1, arg2);
},
method1: function() {
//
}
});
Class Statics
For defining static members on a class, simply pass a hash to the statics configuration key. These properties can then be accessed on class level. The this keyword resolves to the class within static members.
var cls = require('decl')({
statics: function() {
NAME: 'my/class',
getName: function() {
return this.NAME;
}
}
});
cls.getName() === 'my/class';
typeof (new cls).NAME === 'undefined';
ToDos
- Improve the documentation
- Add support for mixins/traits
- Add support for inheritence of static members (static super?)