UNPKG

@tinytapanalytics/sdk

Version:

Behavioral psychology platform that detects visitor frustration, predicts abandonment, and helps you save at-risk conversions in real-time

60 lines 1.63 kB
/** * Service Worker Manager for TinyTapAnalytics SDK * Handles offline event queuing and background synchronization */ import { TinyTapAnalyticsConfig, QueuedEvent } from '../types/index'; export declare class ServiceWorkerManager { private config; private swConfig; private registration; private isSupported; constructor(config: TinyTapAnalyticsConfig); /** * Initialize Service Worker if supported and enabled */ init(): Promise<void>; /** * Queue event for offline processing */ queueOfflineEvent(event: QueuedEvent): Promise<void>; /** * Trigger background sync for queued events */ triggerSync(): Promise<void>; /** * Get offline queue statistics */ getOfflineStats(): Promise<{ queueSize: number; lastSync: number; }>; /** * Clear offline queue */ clearOfflineQueue(): Promise<void>; /** * Setup message handling between main thread and service worker */ private setupMessageHandling; /** * Setup background sync registration */ private setupBackgroundSync; /** * Send message to service worker and wait for response */ private sendMessageToSW; /** * Check if Service Worker features are supported */ isServiceWorkerSupported(): boolean; /** * Generate Service Worker code for deployment */ static generateServiceWorkerCode(config?: Partial<TinyTapAnalyticsConfig>): string; /** * Clean up Service Worker */ destroy(): Promise<void>; } //# sourceMappingURL=ServiceWorkerManager.d.ts.map