1.0.5 • Published 8 years ago

es6-class-mixin v1.0.5

Weekly downloads
158
License
MIT
Repository
github
Last release
8 years ago

Mixin for ES6 classes

Build Status

Mixins for ES6 Classes. Based on @mattmccray's gist

Install

npm i -S es6-class-mixin

API

mixin extends given class by object with functions or properties.

mixin(ParentClass, ...mixins) // return new MixedClass extended by Mixins

Examples

// Basic
const mixin = require('es6-class-mixin');

class ListItem {};

let draggable = {
  drag() { /* … */ }
};

let droppable = {
  drop() { /* … */ }
};

class DraggableItem extends mixin(ListItem, draggable, droppable) {}
// Backbone
class Input extends mixin(Backbone.View, Dispatcher.mixin) {}

License

MIT