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
- Host: GitHub
- URL: https://github.com/streamich/rx-use
- Owner: streamich
- License: unlicense
- Created: 2020-05-02T13:01:46.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2025-07-28T21:37:16.000Z (11 months ago)
- Last Synced: 2025-07-28T23:23:18.929Z (11 months ago)
- Language: TypeScript
- Homepage:
- Size: 2.37 MB
- Stars: 17
- Watchers: 2
- Forks: 0
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
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.