Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function extensibleClass() {
- let id = 0;
- return class Extensible {
- constructor() {
- this.id = id++;
- }
- extend(template) {
- Object.entries(template)
- .forEach(([key, value]) => {
- if (typeof value === 'function') {
- Object.getPrototypeOf(this)[key] = value;
- } else {
- this[key] = value;
- }
- });
- }
- };
- }());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement