OpenSlides/client/src/app/core/mixins.ts
FinnStutzenstein 7af74fb07a Use Proxies for ViewModels
Also reworked creation of assignments, motions and users.
2019-10-16 09:11:02 +02:00

16 lines
527 B
TypeScript

/**
* Mixes all own properties of all baseCtors into the derivedCtor.
* See https://www.typescriptlang.org/docs/handbook/mixins.html
*/
export function applyMixins(derivedCtor: any, baseCtors: any[]): void {
baseCtors.forEach(baseCtor => {
Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
Object.defineProperty(
derivedCtor.prototype,
name,
Object.getOwnPropertyDescriptor(baseCtor.prototype, name)
);
});
});
}