Vinyl
    Preparing search index...

    Class LazyImpl<T>

    A factory to lazily instantiate a single cached instance.

    Type Parameters

    • T

    Implements

    Index

    Constructors

    Accessors

    Methods

    Constructors

    • Type Parameters

      • T

      Parameters

      • factory: () => T

        A factory function that will be invoked at most once.

      Returns LazyImpl<T>

    Accessors

    • get constructed(): boolean

      True if the lazy instance has been constructed.

      Returns boolean

    • get value(): T

      Sets the lazy instance's value. If disposed, a DisposedError will be thrown.

      Returns T

    • set value(value: T): void

      Sets the lazy instance's value. If disposed, a DisposedError will be thrown.

      Parameters

      • value: T

      Returns void

    Methods

    • Clears the lazy instance, disposing its value. Unlike dispose(), this allows the lazy instance to be reconstructed upon the next get. Typically used only in unit testing. May be used after dispose.

      Returns void

    • Returns void