dojo / compose

**DEPRECATED** Dojo 2 - composition library.

Home Page:http://dojo.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Better Mixin Logic

kitsonk opened this issue · comments

From Kit: I never got around to creating a proper API for mixins. We really should have mixins not be factories. There should be something that is FooMixin and the file named FooMixin.ts with the default export being the mixin, and then those mixins composited into final widgets. Having things that look like factories, but are not intended to ever be used as factories is confusing and dangerous.

@pottedmeat and I have a branch with a working proposal for this, which is now a bit out of date, over here: #75 .

The comments there provide a bit more detail, but the idea is that the mixin has the same methods on it as a factory, but it is not a factory, and instead just records the operations to be applied to the base it is mixed into later. I was also experimenting with providing the ability to type the 'target' of the mixin, but currently it has to be exactly the type specified whereas ideally it would allow for a subtype as well.