index.d.ts 3.6 KB

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