chic
chic copied to clipboard
Add mixins
Allow for mixing in methods from another class after class definition. E.g.
var MyClass = Class.extend({});
// Mix in a set of functions
MyClass.mixin({
foo: function () {},
bar: function () {}
});
// Mix in all prototype methods of another class
MyClass.mixin(MyOtherClass);
// Mix in only certain methods of another class
MyClass.mixin(MyOtherClass, ['baz', 'qux']);
I second this. I wonder if it's possible to do it?
Definitely possible, just a bit of a rewrite to the library. I'd probably do this as part of a 2.0 release (not planned at the moment, but maybe soon).
Awesome, looking forward to it! :)