1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { NgZone, OnDestroy } from '@angular/core';
|
---|
9 | import { Observable } from 'rxjs';
|
---|
10 | import { MediaMatcher } from './media-matcher';
|
---|
11 | /** The current state of a layout breakpoint. */
|
---|
12 | export interface BreakpointState {
|
---|
13 | /** Whether the breakpoint is currently matching. */
|
---|
14 | matches: boolean;
|
---|
15 | /**
|
---|
16 | * A key boolean pair for each query provided to the observe method,
|
---|
17 | * with its current matched state.
|
---|
18 | */
|
---|
19 | breakpoints: {
|
---|
20 | [key: string]: boolean;
|
---|
21 | };
|
---|
22 | }
|
---|
23 | /** Utility for checking the matching state of @media queries. */
|
---|
24 | export declare class BreakpointObserver implements OnDestroy {
|
---|
25 | private _mediaMatcher;
|
---|
26 | private _zone;
|
---|
27 | /** A map of all media queries currently being listened for. */
|
---|
28 | private _queries;
|
---|
29 | /** A subject for all other observables to takeUntil based on. */
|
---|
30 | private readonly _destroySubject;
|
---|
31 | constructor(_mediaMatcher: MediaMatcher, _zone: NgZone);
|
---|
32 | /** Completes the active subject, signalling to all other observables to complete. */
|
---|
33 | ngOnDestroy(): void;
|
---|
34 | /**
|
---|
35 | * Whether one or more media queries match the current viewport size.
|
---|
36 | * @param value One or more media queries to check.
|
---|
37 | * @returns Whether any of the media queries match.
|
---|
38 | */
|
---|
39 | isMatched(value: string | readonly string[]): boolean;
|
---|
40 | /**
|
---|
41 | * Gets an observable of results for the given queries that will emit new results for any changes
|
---|
42 | * in matching of the given queries.
|
---|
43 | * @param value One or more media queries to check.
|
---|
44 | * @returns A stream of matches for the given queries.
|
---|
45 | */
|
---|
46 | observe(value: string | readonly string[]): Observable<BreakpointState>;
|
---|
47 | /** Registers a specific query to be listened for. */
|
---|
48 | private _registerQuery;
|
---|
49 | }
|
---|