1.0.3 • Published 10 years ago
mixins-decorator v1.0.3
Apply mixins to your JavaScript classes
With the mixins-decorator modules, you get the reap the benefits of mixins.
var mixin1 = { foo: function () { console.log('foo'); } };
var mixin2 = { bar: function () { console.log('bar'); } };
function Foo() {}
mixins(mixin1, mixin2)(Foo);
// Or, with ES6 classes
@mixins(mixin1, mixin2)
class Foo {}
var foo = new Foo();
foo.foo(); // foo
foo.bar(); // barUsage
Install mixins-decorator using npm:
npm install mixins-decoratorThen, use it in your code like so:
var mixins = require('mixins-decorator');
// ... Declare and define some mixins here ...
function Foo() {}
mixins(mixin1, mixin2)(Foo);
// Or, with ES6 classes
@mixins(mixin1, mixin2)
class Foo {}License
mixins-decorator is ISC Licensed