index.d.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. import * as i0 from '@angular/core';
  2. import { OnDestroy } from '@angular/core';
  3. import { Observable } from 'rxjs';
  4. /**
  5. * Allows observing resize events on multiple elements using a shared set of ResizeObserver.
  6. * Sharing a ResizeObserver instance is recommended for better performance (see
  7. * https://github.com/WICG/resize-observer/issues/59).
  8. *
  9. * Rather than share a single `ResizeObserver`, this class creates one `ResizeObserver` per type
  10. * of observed box ('content-box', 'border-box', and 'device-pixel-content-box'). This avoids
  11. * later calls to `observe` with a different box type from influencing the events dispatched to
  12. * earlier calls.
  13. */
  14. declare class SharedResizeObserver implements OnDestroy {
  15. private _cleanupErrorListener;
  16. /** Map of box type to shared resize observer. */
  17. private _observers;
  18. /** The Angular zone. */
  19. private _ngZone;
  20. constructor();
  21. ngOnDestroy(): void;
  22. /**
  23. * Gets a stream of resize events for the given target element and box type.
  24. * @param target The element to observe for resizes.
  25. * @param options Options to pass to the `ResizeObserver`
  26. * @return The stream of resize events for the element.
  27. */
  28. observe(target: Element, options?: ResizeObserverOptions): Observable<ResizeObserverEntry[]>;
  29. static ɵfac: i0.ɵɵFactoryDeclaration<SharedResizeObserver, never>;
  30. static ɵprov: i0.ɵɵInjectableDeclaration<SharedResizeObserver>;
  31. }
  32. export { SharedResizeObserver };