vue3-game-analytics
Version:
Comprehensive analytics tracking system for Vue 3 game applications
41 lines (40 loc) • 1.45 kB
TypeScript
export * from './circular-buffer';
export * from './performance';
export * from './environment';
/**
* Generate a RFC4122 compliant UUID v4
* @returns UUID string
*/
export declare function generateUUID(): string;
/**
* Extracts data attributes from an HTML element
* @param element HTML element to extract data from
* @param prefix Optional prefix to filter attributes (without 'data-')
* @returns Object with all data attributes
*/
export declare function extractElementData(element: HTMLElement, prefix?: string): Record<string, string>;
/**
* Safely serialize an object to JSON, handling circular references
* @param obj Object to serialize
* @returns JSON string
*/
export declare function safeStringify(obj: any): string;
/**
* Persists data to localStorage with error handling
* @param key Storage key
* @param data Data to store
* @returns true if successful, false otherwise
*/
export declare function persistToStorage(key: string, data: any): boolean;
/**
* Retrieves data from localStorage with error handling
* @param key Storage key
* @returns Retrieved data or null if not found or error
*/
export declare function retrieveFromStorage<T>(key: string): T | null;
/**
* Checks if a function should be executed based on sampling rate
* @param rate Sampling rate between 0 and 1
* @returns True if the function should be executed, false otherwise
*/
export declare function shouldSampleEvent(rate: number): boolean;