UNPKG

2.61 kBTypeScriptView Raw
1import { NgZone } from '@angular/core';
2import { BreakPoint, ɵMatchMedia as MatchMedia, LayoutConfigOptions } from '@angular/flex-layout/core';
3import * as i0 from "@angular/core";
4/**
5 * Special server-only class to simulate a MediaQueryList and
6 * - supports manual activation to simulate mediaQuery matching
7 * - manages listeners
8 */
9export declare class ServerMediaQueryList implements MediaQueryList {
10 private _mediaQuery;
11 private _isActive;
12 private _listeners;
13 get matches(): boolean;
14 get media(): string;
15 constructor(_mediaQuery: string, _isActive?: boolean);
16 /**
17 * Destroy the current list by deactivating the
18 * listeners and clearing the internal list
19 */
20 destroy(): void;
21 /** Notify all listeners that 'matches === TRUE' */
22 activate(): ServerMediaQueryList;
23 /** Notify all listeners that 'matches === false' */
24 deactivate(): ServerMediaQueryList;
25 /** Add a listener to our internal list to activate later */
26 addListener(listener: MediaQueryListListener): void;
27 /** Don't need to remove listeners in the server environment */
28 removeListener(): void;
29 addEventListener(): void;
30 removeEventListener(): void;
31 dispatchEvent(_: Event): boolean;
32 onchange: MediaQueryListListener;
33}
34/**
35 * Special server-only implementation of MatchMedia that uses the above
36 * ServerMediaQueryList as its internal representation
37 *
38 * Also contains methods to activate and deactivate breakpoints
39 */
40export declare class ServerMatchMedia extends MatchMedia {
41 protected _zone: NgZone;
42 protected _platformId: Object;
43 protected _document: any;
44 protected breakpoints: BreakPoint[];
45 protected layoutConfig: LayoutConfigOptions;
46 private _activeBreakpoints;
47 constructor(_zone: NgZone, _platformId: Object, _document: any, breakpoints: BreakPoint[], layoutConfig: LayoutConfigOptions);
48 /** Activate the specified breakpoint if we're on the server, no-op otherwise */
49 activateBreakpoint(bp: BreakPoint): void;
50 /** Deactivate the specified breakpoint if we're on the server, no-op otherwise */
51 deactivateBreakpoint(bp: BreakPoint): void;
52 /**
53 * Call window.matchMedia() to build a MediaQueryList; which
54 * supports 0..n listeners for activation/deactivation
55 */
56 protected buildMQL(query: string): ServerMediaQueryList;
57 static ɵfac: i0.ɵɵFactoryDeclaration<ServerMatchMedia, never>;
58 static ɵprov: i0.ɵɵInjectableDeclaration<ServerMatchMedia>;
59}
60declare type MediaQueryListListener = ((this: MediaQueryList, ev: MediaQueryListEvent) => any) | null;
61export {};