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

Function lazy

packages/core/src/decorators/lazy.ts:15–27  ·  view source on GitHub ↗
(factory: () => unknown)

Source from the content-addressed store, hash-verified

13 * @param factory - A function that returns the value of this property.
14 */
15export function lazy(factory: () => unknown): PropertyDecorator {
16 return (target, propertyKey) => {
17 let value: unknown = UNINITIALIZED;
18 Object.defineProperty(target, propertyKey, {
19 get(): any {
20 if (value === UNINITIALIZED) {
21 value = factory.call(this);
22 }
23 return value;
24 },
25 });
26 };
27}

Callers 6

View2DClass · 0.90
TxtLeafClass · 0.90
SVGClass · 0.90
QuadBezierSegmentClass · 0.90
CubicBezierSegmentClass · 0.90
ArcSegmentClass · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected