/** @packageDocumentation * @module Utils */ /** Options supplied to a [[YieldManager]]. * @public */ export interface YieldManagerOptions { /** The number of times [[YieldManager.allowYield]] must be called to trigger an actual yield. * Default: 1000. */ iterationsBeforeYield?: number; } /** 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](https://github.com/nodejs/node-addon-api/issues/1140). * 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. * @public */ export declare class YieldManager { /** Options controlling the yield behavior. */ readonly options: Readonly>; private _counter; /** Constructor. * @param options Options customizing the yield behavior. Omitted properties are assigned their default values. */ constructor(options?: YieldManagerOptions); /** Increment the iteration counter, yielding control and resetting the counter if [[options.iterationsBeforeYield]] is exceeded. */ allowYield(): Promise; private actualYield; } //# sourceMappingURL=YieldManager.d.ts.map