Created
November 23, 2018 13:35
-
-
Save kharandziuk/e2208701b0ef8de8ce5ff3d358c5c1cb to your computer and use it in GitHub Desktop.
Show some properties of javascript mixins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let HiMixin = Base => class extends Base { | |
| hi () { | |
| console.log('hi') | |
| } | |
| } | |
| let ByeMixin = Base => class extends Base { | |
| bye () { | |
| console.log('bye') | |
| } | |
| } | |
| class Base { } | |
| class HiByeBase extends ByeMixin(HiMixin(Base)) {} | |
| const b = new HiByeBase() | |
| b.hi() | |
| b.bye() | |
| console.log(b instanceof HiByeBase) | |
| console.log(b instanceof ByeMixin) | |
| console.log(b instanceof HiMixin) | |
| console.log(b instanceof Base) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment