@datalyr/web
Version:
Datalyr Web SDK - Modern attribution tracking for web applications
44 lines • 1.29 kB
TypeScript
/**
* Storage Module
* Safe storage wrapper with fallbacks for Safari private mode
*/
interface StorageWrapper {
get(key: string, defaultValue?: any): any;
set(key: string, value: any): boolean;
remove(key: string): boolean;
keys(): string[];
}
declare class SafeStorage implements StorageWrapper {
private storage;
private memory;
private prefix;
constructor(storage: Storage);
get(key: string, defaultValue?: any): any;
set(key: string, value: any): boolean;
remove(key: string): boolean;
keys(): string[];
}
declare class CookieStorage {
private domain;
private maxAge;
private sameSite;
private secure;
constructor(options?: {
domain?: string | 'auto';
maxAge?: number;
sameSite?: 'Strict' | 'Lax' | 'None';
secure?: boolean | 'auto';
});
get(name: string): string | null;
set(name: string, value: string, days?: number): boolean;
remove(name: string): boolean;
/**
* Auto-detect the best domain for cross-subdomain tracking
*/
private getAutoDomain;
}
export declare const storage: SafeStorage;
export declare const sessionStorage: SafeStorage;
export { CookieStorage };
export declare const cookies: CookieStorage;
//# sourceMappingURL=storage.d.ts.map