framework/js/lib/utils/mixin.js

12 lines
275 B
JavaScript
Raw Normal View History

2015-04-25 20:58:39 +08:00
export default function mixin(Parent, ...mixins) {
class Mixed extends Parent {}
for (var i in mixins) {
var keys = Object.keys(mixins[i]);
for (var j in keys) {
var prop = keys[j];
Mixed.prototype[prop] = mixins[i][prop];
}
}
return Mixed;
}