decorator-mixin
v0.1.1
Published
Maps an object's properties to a vuex module's mutations.
Downloads
3
Readme
Decorator Mixin
An implementation of mixins using the new Babel class decorators.
Usage
Pass mixin objects into the mixin function as a decorator on the class. Mixins later in the argument list take priority and will override any methods defined by earlier mixins or the class.
Example
const mixinA = {
methodA () {
console.log('mixinA')
},
methodB () {
console.log('mixinA')
},
}
const mixinB = {
methodB () {
console.log('mixinB')
},
methodC () {
console.log('mixinB')
},
}
@mixin(mixinA, mixinB)
class Klass {
methodA () {
console.log('class')
},
methodB () {
console.log('class')
},
methodD () {
console.log('class')
},
}
const obj = new Klass()
obj.methodA() // 'mixinA'
obj.methodB() // 'mixinB'
obj.methodC() // 'mixinB'
obj.methodD() // 'class'
Contributing
Feedback and merge requests are welcome!