0.2.3 • Published 9 years ago

decl v0.2.3

Weekly downloads
7
License
BSD-3-Clause
Repository
gitlab
Last release
9 years ago

NPM

build status

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?)
0.2.3

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago