Aracılığıyla paylaş


PollerLikeWithCancellation interface

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

Methods

cancelOperation({ abortSignal?: AbortSignalLike })

Attempts to cancel the underlying operation.

getOperationState()

Returns the state of the operation. The TState defined in PollerLike can be a subset of the TState defined in the Poller implementation.

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()

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

stopPolling()

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

toString()

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

Method Details

cancelOperation({ abortSignal?: AbortSignalLike })

Attempts to cancel the underlying operation.

function cancelOperation(options?: { abortSignal?: AbortSignalLike }): Promise<void>

Parameters

options

{ abortSignal?: AbortSignalLike }

Returns

Promise<void>

getOperationState()

Returns the state of the operation. The TState defined in PollerLike can be a subset of the TState defined in the Poller implementation.

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()

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<void>

Parameters

options

{ abortSignal?: AbortSignalLike }

Returns

Promise<void>

pollUntilDone()

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

function pollUntilDone(): Promise<TResult>

Returns

Promise<TResult>

stopPolling()

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

function stopPolling()

toString()

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

function toString(): string

Returns

string