Skip to content

Add mixins #5

Open
rowanmanning opened this Issue Feb 4, 2013 · 3 comments

2 participants

@rowanmanning
Owner

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

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

@rowanmanning
Owner

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

@darkguy2008

Awesome, looking forward to it! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.