Library API
    Preparing search index...

    Function lazyMethod

    • 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.

      Type Parameters

      • T extends object

      Parameters

      • target: T

        The prototype or object to define the method on

      • key: PropertyKey

        The method name

      • factory: (this: T) => Function

        A function returning the actual method implementation

      Returns void

      lazyMethod(MyClass.prototype, 'heavy', () => function() { return 42; });