resize-observer.service.d.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { ElementRef, OnDestroy } from '@angular/core';
  2. import { Observable } from 'rxjs';
  3. import * as i0 from "@angular/core";
  4. /**
  5. * Factory that creates a new ResizeObserver and allows us to stub it out in unit tests.
  6. */
  7. export declare class NzResizeObserverFactory {
  8. create(callback: ResizeObserverCallback): ResizeObserver | null;
  9. static ɵfac: i0.ɵɵFactoryDeclaration<NzResizeObserverFactory, never>;
  10. static ɵprov: i0.ɵɵInjectableDeclaration<NzResizeObserverFactory>;
  11. }
  12. /** An injectable service that allows watching elements for changes to their content. */
  13. export declare class NzResizeObserver implements OnDestroy {
  14. private nzResizeObserverFactory;
  15. /** Keeps track of the existing ResizeObservers so they can be reused. */
  16. private observedElements;
  17. constructor(nzResizeObserverFactory: NzResizeObserverFactory);
  18. ngOnDestroy(): void;
  19. observe(elementOrRef: Element | ElementRef<Element>): Observable<ResizeObserverEntry[]>;
  20. /**
  21. * Observes the given element by using the existing ResizeObserver if available, or creating a
  22. * new one if not.
  23. */
  24. private observeElement;
  25. /**
  26. * Un-observes the given element and cleans up the underlying ResizeObserver if nobody else is
  27. * observing this element.
  28. */
  29. private unobserveElement;
  30. /** Clean up the underlying ResizeObserver for the specified element. */
  31. private cleanupObserver;
  32. static ɵfac: i0.ɵɵFactoryDeclaration<NzResizeObserver, never>;
  33. static ɵprov: i0.ɵɵInjectableDeclaration<NzResizeObserver>;
  34. }