fabric
Version:
Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.
1 lines • 1.05 kB
Source Map (JSON)
{"version":3,"file":"applyMixins.min.mjs","names":[],"sources":["../../../src/util/applyMixins.ts"],"sourcesContent":["import type { Constructor } from '../typedefs';\n\n/***\n * https://www.typescriptlang.org/docs/handbook/mixins.html#alternative-pattern\n */\nexport function applyMixins<T extends Constructor, S extends Constructor>(\n derivedCtor: T,\n constructors: S[],\n) {\n constructors.forEach((baseCtor) => {\n Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {\n name !== 'constructor' &&\n Object.defineProperty(\n derivedCtor.prototype,\n name,\n Object.getOwnPropertyDescriptor(baseCtor.prototype, name) ||\n Object.create(null),\n );\n });\n });\n return derivedCtor as T & { prototype: InstanceType<T & S> };\n}\n"],"mappings":"AAKA,SAAgB,EACd,EACA,EAAA,CAaA,OAXA,EAAa,QAAS,GAAA,CACpB,OAAO,oBAAoB,EAAS,UAAA,CAAW,QAAS,GAAA,CACtD,IAAS,eACP,OAAO,eACL,EAAY,UACZ,EACA,OAAO,yBAAyB,EAAS,UAAW,EAAA,EAClD,OAAO,OAAO,KAAA,CAAA,EAAA,EAAA,CAIjB,EAAA,OAAA,KAAA"}