Detalhes do pacote

rx-use

streamich381Unlicense1.8.2

Sensor and side-effect library for rxjs. Do you want to contribute? See, help wanted.

readme (leia-me)

rx-use

Sensor and side-effect library for rxjs. Do you want to contribute? See, help wanted.

Observables

  • location$ — browser location and history sensor.
    • pathname$ — browser location pathname sensor.
  • network$ — returns consolidate network status info.
    • onLine$boolean whether user is on-line.
    • connection$ — information about user's network connection.
  • windowSize$ and windowSizeRaf$ — browser window dimension sensor.
  • darkTheme$ — emits true if UI should use dark theme.
  • matchMedia$() — returns boolean indicating media query match.
  • stdin$ — listen for data coming from STDIN.
  • ansiKeys$ — listen for ANSI terminal key presses.
  • pubsub — publish/subscribe mechanism for inter-tab communication in browser.
  • tablist — keeps track of all same origin tabs, elects leader and allows to send messages to all tabs or create private channels between any two tabs.

Operators

  • raf() — de-bounces events using window.requestAnimationFrame.

Other

  • fromStream() — constructs observable from Node.js readable stream.

Most observables imported from this library have ReadonlyBehaviorSubject type. Which is an Observable with an extra .getValue() to access the current value of the observable.

type ReadonlyBehaviorSubject<T> = Observable<T> & Pick<BehaviorSubject<T>, 'getValue'>;

License

Unlicense — public domain.

changelog (log de mudanças)

1.8.2 (2025-05-17)

Bug Fixes

  • 🐛 check for window global directly (0d44a47)
  • 🐛 fixup tests and address linter issues (7f113a0)

1.8.1 (2022-04-25)

Bug Fixes

1.8.0 (2022-04-22)

Bug Fixes

  • 🐛 allow re-sending duplicate mussages over localStorage (ec7bcb3)

Features

  • 🎸 add ability for tabs to establish call channels (130ac0b)
  • 🎸 add dependency injection to tablist (c21aa92)
  • 🎸 allow broadcast channels to be numbers (e7432a6)
  • 🎸 elect oldest tab a the leader (5a62949)
  • 🎸 implement TabList (04b9608)
  • 🎸 make in-memory pubsub busses global (1edaf30)
  • 🎸 make pubsub channel name configurable (55dbae1)

1.7.0 (2022-04-20)

Features

  • 🎸 add el() helper (e6fae4c)
  • 🎸 add PubSub implementation on top of BroadcastChannel (561d542)
  • 🎸 allow dynamic children in el() (4ed8c5e)
  • 🎸 improve pubsub implementation (0df54f9)

1.6.0 (2020-07-19)

Features

  • 🎸 add STDIN and ANSI key sensors (239ada3)

1.5.1 (2020-06-03)

Bug Fixes

  • 🐛 correctly set initial value in matchMedia$ (c173deb)

1.5.0 (2020-06-02)

Bug Fixes

  • 🐛 correctly emit darkTheme$ values (c9a0166)
  • 🐛 make match media observables behave like behavior subjec (71a5d0c)

Features

1.4.0 (2020-05-16)

Features

  • 🎸 add colorSchemeDark$ (fd75060)
  • 🎸 add colorSchemeLight$ (c6161db)
  • 🎸 add colorSchemeNoPreference$ (b2cca5c)
  • 🎸 add darkTheme$ (a605077)
  • 🎸 use ReadonlyBehaviorSubject as export type (ddeaf01)

1.3.0 (2020-05-16)

Features

  • 🎸 add matchMedia$ observable (939898c)
  • 🎸 improve matchMedia$ observable (021f1aa)

1.2.0 (2020-05-03)

Features

  • 🎸 add onLine$, connection$ and network$ observables (b36ede5)

1.1.0 (2020-05-02)

Features

  • 🎸 add pathname$ observable (08857ad)

1.0.0 (2020-05-02)

Features

  • 🎸 add location$ observable (ed69dd2)
  • 🎸 add raf() operator (551aa7e)
  • 🎸 add windowSize$ observable (c1d7bc1)
  • 🎸 add windowSizeRaf$ obsevable (7f1ba89)
  • 🎸 improve location$ implementation (97591ec)