MCPcopy
hub / github.com/midrender/revideo / addInitializer

Function addInitializer

packages/2d/src/lib/decorators/initializers.ts:5–19  ·  view source on GitHub ↗
(target: any, initializer: Initializer<T>)

Source from the content-addressed store, hash-verified

3export type Initializer<T> = (instance: T, context?: any) => void;
4
5export function addInitializer<T>(target: any, initializer: Initializer<T>) {
6 if (!target[INITIALIZERS]) {
7 target[INITIALIZERS] = [];
8 } else if (
9 // if one of the prototypes has initializers
10 target[INITIALIZERS] &&
11 // and it's not the target object itself
12 !Object.prototype.hasOwnProperty.call(target, INITIALIZERS)
13 ) {
14 const base = Object.getPrototypeOf(target);
15 target[INITIALIZERS] = [...base[INITIALIZERS]];
16 }
17
18 target[INITIALIZERS].push(initializer);
19}
20
21export function initialize(target: any, context?: any) {
22 if (target[INITIALIZERS]) {

Callers 6

Layout.tsFile · 0.90
computedFunction · 0.90
compoundFunction · 0.90
filtersSignalFunction · 0.90
signalFunction · 0.90
codeSignalFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected