UpdateSource
An update source is an object that acts as the source of updates for a runner. It features an async generator of updates that produces batches of updates in the form of arrays.
The size of the batches can be adjusted on the fly by setting the generator pace. This will prevent the generator from yielding more than the specified number of updates. It may yield fewer updates.
Update sources can be closed. If you are currently polling updates from the async iterator, closing the update source will raise an abort signal.
If you then want to start pulling updates from the source again, you can simply begin iterating over the generator again.
An active flag signals whether the update source is currently active (pulling in updates) or whether it has been terminated.
Methods
generator
generator(): AsyncGenerator<Y[]>;
Returns this source’s async generator.
setGeneratorPace
setGeneratorPace(pace: number): void;
Sets the maximal pace of the generator. This limits how many updates the generator will yield.
isActive
isActive(): boolean;
Returns whether the source is currently active.
close
close(): void;
Closes the source, i.e. interrupts the current request for more updates. The source can be re-opened by simply beginning to iterate over the generator again.