@scandit/web-datacapture-id
Version:
Scandit Data Capture SDK for the Web
22 lines (21 loc) • 689 B
TypeScript
type Data = Record<string, unknown>;
/**
* A storage that throttles writes to the underlying storage.
* This is useful to avoid excessive writes to the storage, as we may have many updates
* of the data in a short period of time.
*/
export declare class WriteThrottledStorage {
private static readonly DEFAULT_WRITE_INTERVAL_MS;
private readonly _storage;
private _lastWrite;
private _pendingData?;
private _writeTimer?;
private readonly _writeIntervalMs;
constructor(storage: Storage, writeIntervalMs?: number);
hasDataAlreadyWritten(): boolean;
write(data: Data): Data;
read(): Data;
clear(): void;
private scheduleWrite;
}
export {};