Defines a lazy method on a prototype that reifies (shadows) itself upon first access. This allows heavy logic to be deferred while maintaining a clean, synchronous public API.
The prototype or object to define the method on
The method name
A function returning the actual method implementation
lazyMethod(MyClass.prototype, 'heavy', () => function() { return 42; }); Copy
lazyMethod(MyClass.prototype, 'heavy', () => function() { return 42; });
Defines a lazy method on a prototype that reifies (shadows) itself upon first access. This allows heavy logic to be deferred while maintaining a clean, synchronous public API.