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 { BooleanInput, NumberInput } from '@angular/cdk/coercion';
|
---|
9 | import { AfterContentInit, ElementRef, EventEmitter, NgZone, OnDestroy } from '@angular/core';
|
---|
10 | import { Observable } from 'rxjs';
|
---|
11 | /**
|
---|
12 | * Factory that creates a new MutationObserver and allows us to stub it out in unit tests.
|
---|
13 | * @docs-private
|
---|
14 | */
|
---|
15 | import * as ɵngcc0 from '@angular/core';
|
---|
16 | export declare class MutationObserverFactory {
|
---|
17 | create(callback: MutationCallback): MutationObserver | null;
|
---|
18 | static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MutationObserverFactory, never>;
|
---|
19 | }
|
---|
20 | /** An injectable service that allows watching elements for changes to their content. */
|
---|
21 | export declare class ContentObserver implements OnDestroy {
|
---|
22 | private _mutationObserverFactory;
|
---|
23 | /** Keeps track of the existing MutationObservers so they can be reused. */
|
---|
24 | private _observedElements;
|
---|
25 | constructor(_mutationObserverFactory: MutationObserverFactory);
|
---|
26 | ngOnDestroy(): void;
|
---|
27 | /**
|
---|
28 | * Observe content changes on an element.
|
---|
29 | * @param element The element to observe for content changes.
|
---|
30 | */
|
---|
31 | observe(element: Element): Observable<MutationRecord[]>;
|
---|
32 | /**
|
---|
33 | * Observe content changes on an element.
|
---|
34 | * @param element The element to observe for content changes.
|
---|
35 | */
|
---|
36 | observe(element: ElementRef<Element>): Observable<MutationRecord[]>;
|
---|
37 | /**
|
---|
38 | * Observes the given element by using the existing MutationObserver if available, or creating a
|
---|
39 | * new one if not.
|
---|
40 | */
|
---|
41 | private _observeElement;
|
---|
42 | /**
|
---|
43 | * Un-observes the given element and cleans up the underlying MutationObserver if nobody else is
|
---|
44 | * observing this element.
|
---|
45 | */
|
---|
46 | private _unobserveElement;
|
---|
47 | /** Clean up the underlying MutationObserver for the specified element. */
|
---|
48 | private _cleanupObserver;
|
---|
49 | static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<ContentObserver, never>;
|
---|
50 | }
|
---|
51 | /**
|
---|
52 | * Directive that triggers a callback whenever the content of
|
---|
53 | * its associated element has changed.
|
---|
54 | */
|
---|
55 | export declare class CdkObserveContent implements AfterContentInit, OnDestroy {
|
---|
56 | private _contentObserver;
|
---|
57 | private _elementRef;
|
---|
58 | private _ngZone;
|
---|
59 | /** Event emitted for each change in the element's content. */
|
---|
60 | readonly event: EventEmitter<MutationRecord[]>;
|
---|
61 | /**
|
---|
62 | * Whether observing content is disabled. This option can be used
|
---|
63 | * to disconnect the underlying MutationObserver until it is needed.
|
---|
64 | */
|
---|
65 | get disabled(): any;
|
---|
66 | set disabled(value: any);
|
---|
67 | private _disabled;
|
---|
68 | /** Debounce interval for emitting the changes. */
|
---|
69 | get debounce(): number;
|
---|
70 | set debounce(value: number);
|
---|
71 | private _debounce;
|
---|
72 | private _currentSubscription;
|
---|
73 | constructor(_contentObserver: ContentObserver, _elementRef: ElementRef<HTMLElement>, _ngZone: NgZone);
|
---|
74 | ngAfterContentInit(): void;
|
---|
75 | ngOnDestroy(): void;
|
---|
76 | private _subscribe;
|
---|
77 | private _unsubscribe;
|
---|
78 | static ngAcceptInputType_disabled: BooleanInput;
|
---|
79 | static ngAcceptInputType_debounce: NumberInput;
|
---|
80 | static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<CdkObserveContent, never>;
|
---|
81 | static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<CdkObserveContent, "[cdkObserveContent]", ["cdkObserveContent"], { "disabled": "cdkObserveContentDisabled"; "debounce": "debounce"; }, { "event": "cdkObserveContent"; }, never>;
|
---|
82 | }
|
---|
83 | export declare class ObserversModule {
|
---|
84 | static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<ObserversModule, never>;
|
---|
85 | static ɵmod: ɵngcc0.ɵɵNgModuleDeclaration<ObserversModule, [typeof CdkObserveContent], never, [typeof CdkObserveContent]>;
|
---|
86 | static ɵinj: ɵngcc0.ɵɵInjectorDeclaration<ObserversModule>;
|
---|
87 | }
|
---|
88 |
|
---|
89 | //# sourceMappingURL=observe-content.d.ts.map |
---|