@iotile/iotile-device
Version:
A typescript library for interfacing with IOTile BLE devices
17 lines (16 loc) • 610 B
TypeScript
/**
* A sliding window reordering helper class.
*
* This class takes tuples (value, sequence_number) and a callback that should be
* called as `callback(value)` but in order of sequence_number. If a sequence
* number is received out of order, it puts it into a holding list to be dispatched
* at the appropriate time.
*/
export declare class SlidingWindowReorderer<T> {
private nextExpected;
private onHold;
private callback;
constructor(callback: (value: T) => void | Promise<void>);
call(value: T, sequence: number | null): void;
private tryDispatchInOrder;
}