UNPKG

@datalyr/web

Version:

Datalyr Web SDK - Modern attribution tracking for web applications

98 lines 2 kB
/** * Event Queue and Batching Module */ import type { IngestEventPayload, NetworkStatus } from './types'; export declare class EventQueue { private queue; private offlineQueue; private batchTimer; private periodicFlushInterval; private flushPromise; private networkStatus; private config; private recentEventIds; private MAX_RECENT_EVENT_IDS; private OFFLINE_QUEUE_KEY; constructor(config: any); /** * Add event to queue */ enqueue(event: IngestEventPayload): void; /** * Check if event is duplicate */ private isDuplicateEvent; /** * Check if we should flush the queue */ private shouldFlush; /** * Flush the queue */ flush(): Promise<void>; /** * Internal flush implementation */ private _flush; /** * Send batch of events */ private sendBatch; /** * Setup network status listeners */ private setupNetworkListeners; /** * Start periodic flush timer */ private startPeriodicFlush; /** * Stop periodic flush timer */ private stopPeriodicFlush; /** * Move events to offline queue */ private moveToOfflineQueue; /** * Load offline queue from storage */ private loadOfflineQueue; /** * Save offline queue to storage */ private saveOfflineQueue; /** * Process offline queue */ private processOfflineQueue; /** * Get queue size */ getQueueSize(): number; /** * Get offline queue size */ getOfflineQueueSize(): number; /** * Get network status */ getNetworkStatus(): NetworkStatus; /** * Force flush (for page unload) */ forceFlush(): Promise<void>; /** * Clear queue */ clear(): void; /** * Debug logging */ private log; /** * Cleanup resources */ destroy(): void; } //# sourceMappingURL=queue.d.ts.map