UNPKG

@fiddle-digital/string-responsive

Version:

StringResponsive is a comprehensive JavaScript library for responsive design management in web applications. It enables dynamic handling of device-specific media queries and events, allowing developers to programmatically adjust UI and functionality based

62 lines (61 loc) 1.68 kB
interface DeviceQueryConfig { min?: number; max?: number; enable?: boolean; } interface QueryConfig { mobile?: DeviceQueryConfig; tablet?: DeviceQueryConfig; laptop?: DeviceQueryConfig; desktop?: DeviceQueryConfig; } declare class StringResponsiveDeviceEvent { private eventsIn; private eventsOut; private stringResponsive; private state; constructor(stringResponsive: StringResponsive, state: StringResponsiveState); addIn(event: Function): void; removeIn(event: Function): void; callIn(): void; addOut(event: Function): void; removeOut(event: Function): void; callOut(): void; } declare enum StringResponsiveState { Mobile = 0, Tablet = 1, Laptop = 2, Desktop = 3 } declare class StringResponsive { private static instance; private mobileQuery; private tabletQuery; private laptopQuery; private desktopQuery; private mobileMatchMedia; private tabletMatchMedia; private laptopMatchMedia; private desktopMatchMedia; mobile: StringResponsiveDeviceEvent; tablet: StringResponsiveDeviceEvent; laptop: StringResponsiveDeviceEvent; desktop: StringResponsiveDeviceEvent; private onMobileEvent; private onTabletEvent; private onLaptopEvent; private onDesktopEvent; private _state; get state(): StringResponsiveState; private constructor(); static getInstance(): StringResponsive; setQuery(config: QueryConfig): void; private setupQueries; private matchMedia; private onMobileQuery; private onTabletQuery; private onLaptopQuery; private onDesktopQuery; } export default StringResponsive;