SimplePollerLike interface

A simple poller that can be used to poll a long running operation.

Methods

getOperationState()

Returns the state of the operation.

getResult()

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.

isDone()

Returns true if the poller has finished polling.

isStopped()

Returns true if the poller is stopped.

onProgress((state: TState) => void)

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.

poll({ abortSignal?: AbortSignalLike })

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.

pollUntilDone({ abortSignal?: AbortSignalLike })

Returns a promise that will resolve once the underlying operation is completed.

serialize()

Returns a promise that could be used for serialized version of the poller's operation by invoking the operation's serialize method.

stopPolling()

Stops the poller from continuing to poll. Please note this will only stop the client-side polling

submitted()

Wait the poller to be submitted.

toString()

Returns a string representation of the poller's operation. Similar to serialize but returns a string.

Method Details

getOperationState()

Returns the state of the operation.

function getOperationState(): TState

Returns

TState

getResult()

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.

function getResult(): undefined | TResult

Returns

undefined | TResult

isDone()

Returns true if the poller has finished polling.

function isDone(): boolean

Returns

boolean

isStopped()

Warning

This API is now deprecated.

Use abortSignal status to track this instead.

Returns true if the poller is stopped.

function isStopped(): boolean

Returns

boolean

onProgress((state: TState) => void)

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.

function onProgress(callback: (state: TState) => void): CancelOnProgress

Parameters

callback

(state: TState) => void

Returns

poll({ abortSignal?: AbortSignalLike })

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.

function poll(options?: { abortSignal?: AbortSignalLike }): Promise<TState>

Parameters

options

{ abortSignal?: AbortSignalLike }

Returns

Promise<TState>

pollUntilDone({ abortSignal?: AbortSignalLike })

Returns a promise that will resolve once the underlying operation is completed.

function pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise<TResult>

Parameters

pollOptions

{ abortSignal?: AbortSignalLike }

Returns

Promise<TResult>

serialize()

Returns a promise that could be used for serialized version of the poller's operation by invoking the operation's serialize method.

function serialize(): Promise<string>

Returns

Promise<string>

stopPolling()

Warning

This API is now deprecated.

Use abortSignal to stop polling instead.

Stops the poller from continuing to poll. Please note this will only stop the client-side polling

function stopPolling()

submitted()

Wait the poller to be submitted.

function submitted(): Promise<void>

Returns

Promise<void>

toString()

Warning

This API is now deprecated.

Use serialize() instead.

Returns a string representation of the poller's operation. Similar to serialize but returns a string.

function toString(): string

Returns

string