UNPKG

@itwin/presentation-hierarchies

Version:

A package for creating hierarchies based on data in iTwin.js iModels.

24 lines 1.1 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", { value: true }); exports.releaseMainThreadOnItemsCount = releaseMainThreadOnItemsCount; const rxjs_1 = require("rxjs"); /** * Emits a certain amount of values, then releases the main thread for other timers to use. * @internal */ function releaseMainThreadOnItemsCount(elementCount) { return (obs) => { return obs.pipe((0, rxjs_1.bufferCount)(elementCount), (0, rxjs_1.concatMap)((buff, i) => { const out = (0, rxjs_1.of)(buff); if (i === 0 && buff.length < elementCount) { return out; } return out.pipe((0, rxjs_1.delay)(0)); }), (0, rxjs_1.concatAll)()); }; } //# sourceMappingURL=ReleaseMainThread.js.map