Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface PollerLike<TState, TResult>

Package version

Abstract representation of a poller, intended to expose just the minimal API that the user needs to work with.

Type parameters

Hierarchy

  • PollerLike

Implemented by

Index

Methods

cancelOperation

  • cancelOperation(options?: undefined | { abortSignal?: AbortSignalLike }): Promise<void>
  • Attempts to cancel the underlying operation.

    Parameters

    • Optional options: undefined | { abortSignal?: AbortSignalLike }

    Returns Promise<void>

getOperationState

  • getOperationState(): TState
  • Returns the state of the operation. The TState defined in PollerLike can be a subset of the TState defined in the Poller implementation.

    Returns TState

getResult

  • getResult(): TResult | undefined
  • Returns the result value of the operation, regardless of the state of the poller. It can return undefined or an incomplete form of the final TResult value depending on the implementation.

    Returns TResult | undefined

isDone

  • isDone(): boolean
  • Returns true if the poller has finished polling.

    Returns boolean

isStopped

  • isStopped(): boolean
  • Returns true if the poller is stopped.

    Returns boolean

onProgress

  • Invokes the provided callback after each polling is completed, sending the current state of the poller's operation.

    It returns a method that can be used to stop receiving updates on the given callback function.

    Parameters

    • callback: (state: TState) => void
        • (state: TState): void
        • Parameters

          • state: TState

          Returns void

    Returns CancelOnProgress

poll

  • poll(options?: undefined | { abortSignal?: AbortSignalLike }): Promise<void>
  • Returns a promise that will resolve once a single polling request finishes. It does this by calling the update method of the Poller's operation.

    Parameters

    • Optional options: undefined | { abortSignal?: AbortSignalLike }

    Returns Promise<void>

pollUntilDone

  • pollUntilDone(): Promise<TResult>
  • Returns a promise that will resolve once the underlying operation is completed.

    Returns Promise<TResult>

stopPolling

  • stopPolling(): void
  • Stops the poller. After this, no manual or automated requests can be sent.

    Returns void

toString

  • toString(): string
  • Returns a serialized version of the poller's operation by invoking the operation's toString method.

    Returns string

Generated using TypeDoc