Skip to content

@epikodelabs/streamix


@epikodelabs/streamix / dom/src/public-api / onOrientation

Function: onOrientation()

onOrientation(): Stream<"portrait" | "landscape">

Defined in: projects/libraries/streamix/dom/src/lib/streams/onOrientation.ts:17

Creates a reactive stream that emits the current screen orientation, either "portrait" or "landscape", whenever it changes.

Behavior:

  • Emits the initial orientation on start.
  • Emits whenever the orientation changes.
  • 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.

Returns

Stream<"portrait" | "landscape">

Released under the GNU AGPL v3 or later.