@adviser/cement - v0.0.0
    Preparing search index...

    Class AsyncResolveOnce<T, CTX>

    Type Parameters

    • T
    • CTX = void
    Index

    Constructors

    Accessors

    Methods

    Constructors

    Accessors

    • get queueLength(): number

      Returns the total number of queued futures across all items.

      Returns number

    • get error(): Error | undefined

      Gets the cached error if one occurred.

      Returns Error | undefined

    Methods

    • Executes the async function once and caches the result. Subsequent calls return the cached promise without re-executing.

      Parameters

      • fn: (ctx?: CTX) => T

        The async function to execute

      Returns T

      A promise that resolves to the function's result

    • Resets the cached state, allowing the function to be executed again.

      Parameters

      • Optionalfn: (c?: CTX) => T

        Optional function to execute immediately after reset

      Returns T

      The result if fn provided, undefined otherwise