Namespace: Viewport:BreakpointObserver

Viewport:BreakpointObserver

Members

(static) BreakpointObserver

A class observing a defined list of breakpoints, notifying subscribers, if the breakpoint changes for whatever reason (viewport resizes or device orientation changes mostly).

See class documentation below for details.

Source:
See:
Example
(new BreakpointObserver((to, from) => {
    alert(`breakpoint changed from "${from}" to "${to}"`);
})).observe({
    small : 0,
    medium : 768,
    large : 1024,
    xlarge : 1440
});
(new BreakpointObserver())
    .observe(
        {small : 0},
        ['medium', 768],
        [
            {large : 1024},
            ['xlarge', 1440]
        ]
    )
    .unobserve('xlarge')
    .getCurrentBreakpoint()
;
=> 'medium'