[6a3a178] | 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 | export declare class MutationObserverFactory {
|
---|
| 16 | create(callback: MutationCallback): MutationObserver | null;
|
---|
| 17 | }
|
---|
| 18 | /** An injectable service that allows watching elements for changes to their content. */
|
---|
| 19 | export declare class ContentObserver implements OnDestroy {
|
---|
| 20 | private _mutationObserverFactory;
|
---|
| 21 | /** Keeps track of the existing MutationObservers so they can be reused. */
|
---|
| 22 | private _observedElements;
|
---|
| 23 | constructor(_mutationObserverFactory: MutationObserverFactory);
|
---|
| 24 | ngOnDestroy(): void;
|
---|
| 25 | /**
|
---|
| 26 | * Observe content changes on an element.
|
---|
| 27 | * @param element The element to observe for content changes.
|
---|
| 28 | */
|
---|
| 29 | observe(element: Element): Observable<MutationRecord[]>;
|
---|
| 30 | /**
|
---|
| 31 | * Observe content changes on an element.
|
---|
| 32 | * @param element The element to observe for content changes.
|
---|
| 33 | */
|
---|
| 34 | observe(element: ElementRef<Element>): Observable<MutationRecord[]>;
|
---|
| 35 | /**
|
---|
| 36 | * Observes the given element by using the existing MutationObserver if available, or creating a
|
---|
| 37 | * new one if not.
|
---|
| 38 | */
|
---|
| 39 | private _observeElement;
|
---|
| 40 | /**
|
---|
| 41 | * Un-observes the given element and cleans up the underlying MutationObserver if nobody else is
|
---|
| 42 | * observing this element.
|
---|
| 43 | */
|
---|
| 44 | private _unobserveElement;
|
---|
| 45 | /** Clean up the underlying MutationObserver for the specified element. */
|
---|
| 46 | private _cleanupObserver;
|
---|
| 47 | }
|
---|
| 48 | /**
|
---|
| 49 | * Directive that triggers a callback whenever the content of
|
---|
| 50 | * its associated element has changed.
|
---|
| 51 | */
|
---|
| 52 | export declare class CdkObserveContent implements AfterContentInit, OnDestroy {
|
---|
| 53 | private _contentObserver;
|
---|
| 54 | private _elementRef;
|
---|
| 55 | private _ngZone;
|
---|
| 56 | /** Event emitted for each change in the element's content. */
|
---|
| 57 | readonly event: EventEmitter<MutationRecord[]>;
|
---|
| 58 | /**
|
---|
| 59 | * Whether observing content is disabled. This option can be used
|
---|
| 60 | * to disconnect the underlying MutationObserver until it is needed.
|
---|
| 61 | */
|
---|
| 62 | get disabled(): any;
|
---|
| 63 | set disabled(value: any);
|
---|
| 64 | private _disabled;
|
---|
| 65 | /** Debounce interval for emitting the changes. */
|
---|
| 66 | get debounce(): number;
|
---|
| 67 | set debounce(value: number);
|
---|
| 68 | private _debounce;
|
---|
| 69 | private _currentSubscription;
|
---|
| 70 | constructor(_contentObserver: ContentObserver, _elementRef: ElementRef<HTMLElement>, _ngZone: NgZone);
|
---|
| 71 | ngAfterContentInit(): void;
|
---|
| 72 | ngOnDestroy(): void;
|
---|
| 73 | private _subscribe;
|
---|
| 74 | private _unsubscribe;
|
---|
| 75 | static ngAcceptInputType_disabled: BooleanInput;
|
---|
| 76 | static ngAcceptInputType_debounce: NumberInput;
|
---|
| 77 | }
|
---|
| 78 | export declare class ObserversModule {
|
---|
| 79 | }
|
---|