import { BehaviorSubjectable } from '../abstract/behavior.subjectable'; export interface IBreakpoints { xs: number; sm: number; md: number; lg: number; xl: number; } export declare type Screensize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'; export declare const DefaultBreakpoints: IBreakpoints; /** * ScreenSizeDetection * =================== * * ## Usage * * Firste create the class-instance and pass your custom breakpoints * to the constructor. Use this class-instance as the default exported member. * If you don't pass breakpoints to the constructor, the class will use a default * breakpoint configuration, which is the one you see in the following code-example. * * ```typescript * import { * ScreensizeDetectionSubject, * IBreakpoints * } from '@mralexandernickel/frontend.subjects/dist/screensize.detection/screensize.detection'; * * export const Breakpoints: IBreakpoints = { * xs: 0, * sm: 576, * md: 768, * lg: 992, * xl: 1200 * } * * export default new ScreensizeDetectionSubject(Breakpoints); * ``` * * Now you can import and use this singleton-instance in any module you want, * and will be informed whenever the screen passes one of your breakpoints. * * ```typescript * import ScreensizeDetection from 'ScreensizeDetection'; * * ScreensizeDetection.get().subscribe(screensize => { * console.log(`Screensize is now ${screensize}`); * }); * ``` */ export declare class ScreensizeDetectionSubject extends BehaviorSubjectable { breakpoints: IBreakpoints; mocksize?: number; /** * The current screensize */ screensize: Screensize; /** * Determines if we are publishing for the first time */ private subjectFirst; /** * @constructor * @param {IBreakpoints} breakpoints optional custom breakpoint configuration * @param {number} mocksize optional mocked screen-width for testing purposes */ constructor(breakpoints?: IBreakpoints, mocksize?: number); /** * Calculates the matching screensize depending on window.innerWidth * @return {ScreenSize} the currently active ScreenSize defined in Breakpoints */ calculate(): Screensize; /** * Callback function for the resize-event * @return {void} */ resizeHandler(): void; }