An open API service indexing awesome lists of open source software.

https://github.com/streamich/rx-use

RxJS DOM sensors
https://github.com/streamich/rx-use

Last synced: 11 months ago
JSON representation

RxJS DOM sensors

Awesome Lists containing this project

README

          

# rx-use

Sensor and side-effect library for [`rxjs`](https://rxjs-dev.firebaseapp.com/). Do you want to contribute? See, [`help wanted`](https://github.com/streamich/rx-use/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22).

## Observables

- [`location$`](./docs/location$.md) — browser location and history sensor.
- [`pathname$`](./docs/pathname$.md) — browser location pathname sensor.
- [`network$`](./docs/network$.md) — returns consolidate network status info.
- [`onLine$`](./docs/onLine$.md) — `boolean` whether user is on-line.
- [`connection$`](./docs/connection$.md) — information about user's network connection.
- [`windowSize$`](./docs/windowSize$.md) and [`windowSizeRaf$`](./docs/windowSizeRaf$.md) — browser window dimension sensor.
- [`darkTheme$`](./docs/darkTheme$.md) — emits `true` if UI should use dark theme.
- [`matchMedia$()`](./docs/matchMedia$.md) — returns boolean indicating media query match.
- [`colorSchemeDark$`](./docs/colorSchemeDark$.md) — whether user selected dark theme in system settings.
- [`colorSchemeLight$`](./docs/colorSchemeLight$.md) — whether user selected light theme in system settings.
- [`colorSchemeNoPreference$`](./docs/colorSchemeNoPreference$.md) — whether user has no preference for color scheme.
- `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`](./src/tablist/README.md) — 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()`](./docs/raf.md) — 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.

```ts
type ReadonlyBehaviorSubject = Observable & Pick, 'getValue'>;
```

## License

[Unlicense](LICENSE) — public domain.