@itwin/presentation-hierarchies
Version:
A package for creating hierarchies based on data in iTwin.js iModels.
21 lines • 939 B
JavaScript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import { bufferCount, concatAll, concatMap, delay, of } from "rxjs";
/**
* Emits a certain amount of values, then releases the main thread for other timers to use.
* @internal
*/
export function releaseMainThreadOnItemsCount(elementCount) {
return (obs) => {
return obs.pipe(bufferCount(elementCount), concatMap((buff, i) => {
const out = of(buff);
if (i === 0 && buff.length < elementCount) {
return out;
}
return out.pipe(delay(0));
}), concatAll());
};
}
//# sourceMappingURL=ReleaseMainThread.js.map