Detalhes do pacote

kist-klass

niksy41MITdepreciado0.1.6

Use ES classes

Simple class system.

kist, class, browserify

readme (leia-me)

kist-klass

Simple class system. Inspired by Backbone extend and simple inheritance by John Resig.

Installation

npm install kist-klass --save

bower install kist-klass --save

API

.extend([options])

Returns: Klass

Extend base (or already extended class).

If you provide constructor method, it will override default constructor.

._super

Type: Function

Current class parent.

Examples

var Klass = require('kist-klass');

var Foo = Klass.extend({
    props: {
        foo: 1
    }
});

var Bar = Foo.extend({
    constructor: function () {
        // Constructor logic
        Bar._super.constructor.apply(this, arguments);
    }
    props: {
        bar: 2
    }
});

var foo = new Foo();
var bar = new Bar();

AMD and global

define(['kist-klass'], cb);

window.kist.klass;

Browser support

Tested in IE8+ and all modern browsers.

License

MIT © Ivan Nikolić