YieldManager Class

Provides a mechanism by which a loop can be made to periodically yield control back to the browser/node environment. This can alleviate performance and memory consumption issues. It maintains a count of the number of iterations that have occurred since the last yield. The constructor specifies how many iterations of the loop are permitted before yielding. The loop should await allowYield on each iteration. allowYield will yield (and reset the iteration counter) if the counter exceeds the specified maximum.

Methods

Name Description
constructor(options: YieldManagerOptions{}): YieldManager Constructor.  
allowYield(): Promise<void> Increment the iteration counter, yielding control and resetting the counter if iterationsBeforeYield is exceeded.  

Properties

Name Type Description
options Readonly Readonly<Required<YieldManagerOptions>> Options controlling the yield behavior.  

Defined in

Last Updated: 21 November, 2024