@epikodelabs/streamix / dom/src/public-api / onViewportChange
Function: onViewportChange()
onViewportChange():
Stream<ViewportState>
Defined in: projects/libraries/streamix/dom/src/lib/streams/onViewportChange.ts:29
Creates a reactive stream that emits changes to the visual viewport.
Uses visualViewport when available, falling back to window.
Behavior:
- Emits initial viewport metrics on start.
- Emits on resize, scroll, and zoom.
- Starts listening on first subscriber.
- Stops listening when the last subscriber unsubscribes.
- Safe to import and subscribe in SSR (no-op).
- Fully compatible with async iteration.