UNPKG

saltfish

Version:

An interactive video-guided tour system for web applications

96 lines 3.16 kB
/** * Device detection utilities for determining mobile vs desktop devices * Uses multiple detection methods for better accuracy */ export interface DeviceInfo { isMobile: boolean; isTablet: boolean; isDesktop: boolean; isTouchDevice: boolean; screenSize: 'small' | 'medium' | 'large'; orientation: 'portrait' | 'landscape'; userAgent: string; } /** * Mobile device detection utility class */ export declare class DeviceDetector { private static cachedDeviceInfo; /** * Detects if the current device is mobile using multiple methods * @returns boolean indicating if device is mobile */ static isMobile(): boolean; /** * Detects if the current device is a tablet * @returns boolean indicating if device is a tablet */ static isTablet(): boolean; /** * Detects if the current device is desktop * @returns boolean indicating if device is desktop */ static isDesktop(): boolean; /** * Detects if the current device supports touch * @returns boolean indicating if device supports touch */ static isTouchDevice(): boolean; /** * Gets the current screen orientation * @returns 'portrait' or 'landscape' */ static getOrientation(): 'portrait' | 'landscape'; /** * Gets comprehensive device information * @returns DeviceInfo object with all device details */ static getDeviceInfo(): DeviceInfo; /** * Detects touch support * @returns boolean indicating if touch is supported */ private static detectTouchSupport; /** * Gets screen dimensions * @returns object with width and height */ private static getScreenDimensions; /** * Determines screen size category * @param width Screen width * @param height Screen height * @returns Screen size category */ private static getScreenSize; /** * Detects screen orientation * @returns Current orientation */ private static detectOrientation; /** * Clears the cached device info (useful for testing or when device capabilities change) */ static clearCache(): void; /** * Sets up listeners for orientation and resize changes * @param callback Function to call when device info changes */ static onDeviceChange(callback: (deviceInfo: DeviceInfo) => void): () => void; } /** * Convenience functions for quick device detection */ export declare const isMobile: () => boolean; export declare const isTablet: () => boolean; export declare const isDesktop: () => boolean; export declare const isTouchDevice: () => boolean; export declare const getOrientation: () => "portrait" | "landscape"; export declare const getDeviceInfo: () => DeviceInfo; /** * Checks if the current device is compatible with the specified device type requirement * @param deviceType The device type requirement from playlist manifest * @returns true if device is compatible, false otherwise */ export declare const isDeviceCompatible: (deviceType?: "desktop" | "mobile" | "both") => boolean; //# sourceMappingURL=deviceDetection.d.ts.map