justinfagnani / mixwith.js

A mixin library for ES6

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New mixin base on existing class

atoumbre opened this issue · comments

Hello @justinfagnani

Is it possible to use your mixwith to create a class factory mixin based an existing class (like Node EventEmitter) and use it with mix ?

I think, you might have to make a wrapper-Mixin, as EventEmitter was not created as a Mixin.

@minecrawler is correct. Without accepting a superclass as a parameter, there's no way to apply a class as a mixin. This would be a great language feature though, and compilers could do interesting things too.

@minecrawler How to make a wrapper-Mixin? Can I ask for an example code?