UNPKG

@push.rocks/lik

Version:

Provides a collection of lightweight helpers and utilities for Node.js projects.

21 lines (20 loc) 687 B
export interface ITimedAggregatorOptions<T> { aggregationIntervalInMillis: number; functionForAggregation: (input: T[]) => void; } export declare class TimedAggregtor<T> { options: ITimedAggregatorOptions<T>; private storageArray; private isStopped; constructor(optionsArg: ITimedAggregatorOptions<T>); private aggregationTimer; private checkAggregationStatus; add(aggregationArg: T): void; /** * stops the aggregation timer chain * @param flushRemaining if true, calls functionForAggregation with any remaining items */ stop(flushRemaining?: boolean): void; restart(): void; } export { TimedAggregtor as TimedAggregator };