UNPKG

solo-tab-enforcer

Version:

Cross-browser solution for enforcing single tab usage in web applications

62 lines (53 loc) 1.59 kB
declare module 'solo-tab-enforcer' { export interface TabEnforcerOptions { storageKey?: string; checkInterval?: number; warningMessage?: string; redirectUrl?: string | null; allowMultipleTabs?: boolean; debug?: boolean; onTabConflict?: (existingTab: any) => void; onTabActivated?: () => void; onTabDeactivated?: () => void; useVisibilityAPI?: boolean; useBroadcastChannel?: boolean; useStorageEvents?: boolean; tabTimeoutMs?: number; } export interface TabInfo { id: string; isActive: boolean; isInitialized: boolean; supportedFeatures: FeatureSupport; browserInfo: BrowserInfo; options: TabEnforcerOptions; } export interface BrowserInfo { name: string; version: string; } export interface FeatureSupport { localStorage: boolean; sessionStorage: boolean; broadcastChannel: boolean; visibilityAPI: boolean; storageEvents: boolean; } export class SoloTabEnforcer { constructor(options?: TabEnforcerOptions); init(): void; destroy(): void; getTabInfo(): TabInfo; areMultipleTabsAllowed(): boolean; allowMultipleTabs(): void; disallowMultipleTabs(): void; forceRegister(): void; getSupportedFeatures(): FeatureSupport; getBrowserInfo(): BrowserInfo; static create(options?: TabEnforcerOptions): SoloTabEnforcer; static createAndInit(options?: TabEnforcerOptions): SoloTabEnforcer; static checkSupport(): FeatureSupport; static getBrowserInfo(): BrowserInfo; } export default SoloTabEnforcer; }