Options
All
  • Public
  • Public/Protected
  • All
Menu

Class KVPoller<TState, TResult>

Package version

A class that represents the definition of a program that polls through consecutive requests until it reaches a state of completion.

This edit of the original interface changes getOperationState() to return TState, which helps to expose any re-interpretation of the state of the operation being polled, such as only publicly available properties.

internal

Type parameters

  • TState: PollOperationState<TResult>

  • TResult

Hierarchy

Implements

Index

Constructors

constructor

  • new KVPoller(operation: PollOperation<TState, TResult>): KVPoller

Properties

Protected operation

operation: PollOperation<TState, TResult>

Methods

cancelOperation

  • cancelOperation(options?: { abortSignal?: AbortSignal }): Promise<void>
  • A method that will try to cancel the underlying operation.

    Parameters

    • Default value options: { abortSignal?: AbortSignal } = {}
      • Optional abortSignal?: AbortSignal

    Returns Promise<void>

Protected Abstract delay

  • delay(): Promise<void>

Abstract getOperationState

  • getOperationState(): TState

getResult

  • getResult(): TResult | undefined
  • A method that will return 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

isStopped

  • isStopped(): boolean

onProgress

  • onProgress(callback: (state: TState) => void): CancelOnProgress
  • A method used by the poller operation to report updates.

    Parameters

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

          • state: TState

          Returns void

    Returns CancelOnProgress

poll

  • poll(options?: { abortSignal?: AbortSignal }): Promise<void>
  • A method that defines under what conditions to reach out to the underlying service. It should call the operation's update method.

    Parameters

    • Default value options: { abortSignal?: AbortSignal } = {}
      • Optional abortSignal?: AbortSignal

    Returns Promise<void>

pollUntilDone

  • pollUntilDone(): Promise<TResult>

stopPolling

  • stopPolling(): void

toString

  • toString(): string

Generated using TypeDoc