Created
May 18, 2018 18:55
-
-
Save leafiy/48e6b5e75b2f2d8c22d9851d6de957cd to your computer and use it in GitHub Desktop.
none
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
| function mix(...mixins){ | |
| class Mix{}; | |
| for (let mixin of mixins){ | |
| copyProperties(Mix,mixin); | |
| copyProperties(Mix.prototype,mixin.prototype); | |
| } | |
| } | |
| function copyProperties(target,source){ | |
| for (let key of Reflect.ownKeys(source)){ | |
| if(key !== 'constructor' && key !== 'prototype' && key !== 'name'){ | |
| let desc = Object.getOwnPropertyDescriptor(source,key); | |
| Object.defineProperty(target,key,desc); | |
| } | |
| } | |
| } | |
| class DistributedEdit extends mix(){} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment