Skip to content

Instantly share code, notes, and snippets.

@leafiy
Created May 18, 2018 18:55
Show Gist options
  • Select an option

  • Save leafiy/48e6b5e75b2f2d8c22d9851d6de957cd to your computer and use it in GitHub Desktop.

Select an option

Save leafiy/48e6b5e75b2f2d8c22d9851d6de957cd to your computer and use it in GitHub Desktop.
none
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