chic icon indicating copy to clipboard operation
chic copied to clipboard

Add mixins

Open rowanmanning opened this issue 12 years ago • 3 comments

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']);

rowanmanning avatar Feb 04 '13 13:02 rowanmanning

I second this. I wonder if it's possible to do it?

darkguy2008 avatar Feb 28 '14 22:02 darkguy2008

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).

rowanmanning avatar Mar 03 '14 10:03 rowanmanning

Awesome, looking forward to it! :)

darkguy2008 avatar Mar 05 '14 17:03 darkguy2008