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 { Platform } from '@angular/cdk/platform';
|
---|
9 | import { NgZone, OnDestroy } from '@angular/core';
|
---|
10 | import { Observable } from 'rxjs';
|
---|
11 | /** Time in ms to throttle the resize events by default. */
|
---|
12 | import * as ɵngcc0 from '@angular/core';
|
---|
13 | export declare const DEFAULT_RESIZE_TIME = 20;
|
---|
14 | /** Object that holds the scroll position of the viewport in each direction. */
|
---|
15 | export interface ViewportScrollPosition {
|
---|
16 | top: number;
|
---|
17 | left: number;
|
---|
18 | }
|
---|
19 | /**
|
---|
20 | * Simple utility for getting the bounds of the browser viewport.
|
---|
21 | * @docs-private
|
---|
22 | */
|
---|
23 | export declare class ViewportRuler implements OnDestroy {
|
---|
24 | private _platform;
|
---|
25 | /** Cached viewport dimensions. */
|
---|
26 | private _viewportSize;
|
---|
27 | /** Stream of viewport change events. */
|
---|
28 | private readonly _change;
|
---|
29 | /** Event listener that will be used to handle the viewport change events. */
|
---|
30 | private _changeListener;
|
---|
31 | /** Used to reference correct document/window */
|
---|
32 | protected _document: Document;
|
---|
33 | constructor(_platform: Platform, ngZone: NgZone, document: any);
|
---|
34 | ngOnDestroy(): void;
|
---|
35 | /** Returns the viewport's width and height. */
|
---|
36 | getViewportSize(): Readonly<{
|
---|
37 | width: number;
|
---|
38 | height: number;
|
---|
39 | }>;
|
---|
40 | /** Gets a ClientRect for the viewport's bounds. */
|
---|
41 | getViewportRect(): ClientRect;
|
---|
42 | /** Gets the (top, left) scroll position of the viewport. */
|
---|
43 | getViewportScrollPosition(): ViewportScrollPosition;
|
---|
44 | /**
|
---|
45 | * Returns a stream that emits whenever the size of the viewport changes.
|
---|
46 | * This stream emits outside of the Angular zone.
|
---|
47 | * @param throttleTime Time in milliseconds to throttle the stream.
|
---|
48 | */
|
---|
49 | change(throttleTime?: number): Observable<Event>;
|
---|
50 | /** Use defaultView of injected document if available or fallback to global window reference */
|
---|
51 | private _getWindow;
|
---|
52 | /** Updates the cached viewport size. */
|
---|
53 | private _updateViewportSize;
|
---|
54 | static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<ViewportRuler, [null, null, { optional: true; }]>;
|
---|
55 | }
|
---|
56 |
|
---|
57 | //# sourceMappingURL=viewport-ruler.d.ts.map |
---|