Created
February 18, 2020 12:24
-
-
Save daKmoR/dc8bcc5d58fa2896f804a76893dfbb39 to your computer and use it in GitHub Desktop.
Markdium-What is a Mixin?
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
// defining the Mixin | |
export const LoggingMixin = superclass => | |
class LoggingMixin extends superclass { | |
// logging logic | |
}; | |
class Page {} | |
// applying a Mixin | |
class PageRed extends LoggingMixin(Page) {} | |
class PageGreen extends LoggingMixin(Page) {} | |
class PageBlue extends Page {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment