@refinio/one.models
    Preparing search index...

    Class default<T, TErr>

    This class can spawn multiple promises and you can resolve / reject multiple ones at the same time.

    Type Parameters

    • T
    • TErr = any
    Index

    Constructors

    • Constructor.

      Type Parameters

      • T
      • TErr = any

      Parameters

      • maxPendingPromiseCount: number = Number.POSITIVE_INFINITY

        Maximum number of unresolved promises before the createPromise function throws.

      • defaultTimeout: number = Number.POSITIVE_INFINITY

        The default timeout for newly created promises.

      Returns default<T, TErr>

    Accessors

    • get pendingPromiseCount(): number

      Get the number of pending promises.

      Returns number

    Methods

    • Add a new promise.

      Note that this function will throw synchronous when the number of pending promises has been exceeded (>= maxPendingPromiseCount).

      Parameters

      • Optionaltimeout: number

        Timeout as unsigned 32-bit integer or Number.POSITIVE_INFINITY. If undefined use the default value passed to the constructor.

      Returns Promise<T>

    • Reject all promises.

      Parameters

      • err: TErr

        argument with which to reject the promises.

      Returns boolean

    • Reject the promise that was added first.

      Parameters

      • err: TErr

        argument with which to reject the promise.

      Returns boolean

    • Reject the promise that was added last.

      Parameters

      • err: TErr

        argument with which to reject the promise.

      Returns boolean

    • Resolve all promises.

      Parameters

      • arg: T

        argument with which to resolve the promises.

      Returns boolean

    • Resolve the promise that was added first.

      Parameters

      • arg: T

        argument with which to resolve the promise.

      Returns boolean

    • Resolve the promise that was added last.

      Parameters

      • arg: T

        argument with which to resolve the promise.

      Returns boolean