Package version:

Interface PollerLikeWithCancellation<TState, TResult>

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

interface PollerLikeWithCancellation<TState, TResult> {
    cancelOperation(options?: {
        abortSignal?: any;
    }): Promise<void>;
    getOperationState(): TState;
    getResult(): undefined | TResult;
    isDone(): boolean;
    isStopped(): boolean;
    onProgress(callback: ((state: TState) => void)): CancelOnProgress;
    poll(options?: {
        abortSignal?: any;
    }): Promise<void>;
    pollUntilDone(): Promise<TResult>;
    stopPolling(): void;
    toString(): string;
}

Type Parameters

Methods

  • Attempts to cancel the underlying operation.

    Parameters

    • Optionaloptions: {
          abortSignal?: any;
      }
      • OptionalabortSignal?: any

    Returns Promise<void>

  • 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

  • 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 undefined | TResult

  • 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): void
        • Parameters

          Returns void

    Returns CancelOnProgress

  • 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

    • Optionaloptions: {
          abortSignal?: any;
      }
      • OptionalabortSignal?: any

    Returns Promise<void>

  • Stops the poller. After this, no manual or automated requests can be sent.

    Returns void

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

    Returns string