rx-use
TypeScript icon, indicating that this package has built-in type declarations

1.8.1 • Public • Published

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.

/rx-use/

    Package Sidebar

    Install

    npm i rx-use

    Weekly Downloads

    1

    Version

    1.8.1

    License

    Unlicense

    Unpacked Size

    80.2 kB

    Total Files

    99

    Last publish

    Collaborators

    • streamich