The poller's operation is available in full to any of the methods of the Poller class and any class extending the Poller class.
Attempts to cancel the underlying operation.
It only optionally receives an object with an abortSignal property, from @azure/abort-controller's AbortSignalLike.
If it's called again before it finishes, it will throw an error.
Optional properties passed to the operation's update method.
The method used by the poller to wait before attempting to update its operation.
Returns the state of the operation.
Even though TState will be the same type inside any of the methods of any extension of the Poller class,
implementations of the pollers can customize what's shared with the public by writing their own
version of the getOperationState
method, and by defining two types, one representing the internal state of the poller
and a public type representing a safe to share subset of the properties of the internal state.
Their definition of getOperationState can then return their public type.
Example:
// Let's say we have our poller's operation state defined as:
interface MyOperationState extends PollOperationState<ResultType> {
privateProperty?: string;
publicProperty?: string;
}
// To allow us to have a true separation of public and private state, we have to define another interface:
interface PublicState extends PollOperationState<ResultType> {
publicProperty?: string;
}
// Then, we define our Poller as follows:
export class MyPoller extends Poller<MyOperationState, ResultType> {
// ... More content is needed here ...
public getOperationState(): PublicState {
const state: PublicState = this.operation.state;
return {
// Properties from PollOperationState<TResult>
isStarted: state.isStarted,
isCompleted: state.isCompleted,
isCancelled: state.isCancelled,
error: state.error,
result: state.result,
// The only other property needed by PublicState.
publicProperty: state.publicProperty
}
}
}
You can see this in the tests of this repository, go to the file:
../test/utils/testPoller.ts
and look for the getOperationState implementation.
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 true if the poller has finished polling.
Returns true if the poller is stopped.
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.
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.
It only optionally receives an object with an abortSignal property, from @azure/abort-controller's AbortSignalLike.
Optional properties passed to the operation's update method.
Returns a promise that will resolve once the underlying operation is completed.
Stops the poller from continuing to poll.
Returns a serialized version of the poller's operation by invoking the operation's toString method.
Generated using TypeDoc
The LRO Engine, a class that performs polling.