# rxpoweredup

> A Typescript RxJS-based library for controlling LEGO Powered UP hubs & peripherals.

Latest version **0.4.11** (published 2025-03-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install rxpoweredup
pnpm add rxpoweredup
yarn add rxpoweredup
bun add rxpoweredup
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.11 |
| Published | 2025-03-29 |
| First published | 2023-08-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 399.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Nikolai Sukhanov |
| Maintainers | nsukhanov |
| Keywords | LEGO, Powered UP, BLE, Bluetooth, RxJS, TypeScript |

## Links

- npm: https://www.npmjs.com/package/rxpoweredup
- Homepage: https://github.com/nvsukhanov/rxPoweredUp/
- npm.io page: https://npm.io/package/rxpoweredup

## Dependencies (3)

- [rxjs](https://npm.io/package/rxjs.md) ^7.0.0
- [tsyringe](https://npm.io/package/tsyringe.md) ^4.0.0
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.2.0

## Alternatives

- [@lexical/table](https://npm.io/package/@lexical/table.md) — 3.0M weekly downloads
- [mantine-datatable](https://npm.io/package/mantine-datatable.md) — 98.2K weekly downloads
- [react-native-collapsible-tab-view](https://npm.io/package/react-native-collapsible-tab-view.md) — 70.6K weekly downloads
- [@handsontable/vue3](https://npm.io/package/@handsontable/vue3.md) — 16.1K weekly downloads
- [vuewordcloud](https://npm.io/package/vuewordcloud.md) — 7.2K weekly downloads

## Recent versions

- 0.4.11 (latest) — 2025-03-29
- 0.4.10 — 2025-03-29
- 0.4.9 — 2025-03-28
- 0.4.8 — 2025-03-27
- 0.4.7 — 2024-05-26
- 0.4.6 — 2024-03-25
- 0.4.5 — 2024-03-09
- 0.4.4 — 2024-03-09
- 0.4.3 — 2024-02-27
- 0.4.2 — 2024-02-27
- 0.4.0 — 2024-02-07
- 0.3.9 — 2024-01-26
- 0.3.8 — 2024-01-22
- 0.3.7 — 2024-01-20
- 0.3.6 — 2024-01-18
- … 19 more at https://npm.io/package/rxpoweredup/versions

## README

# rxPoweredUp

[![GitHub license](https://img.shields.io/github/license/nvsukhanov/rxpoweredup)](https://github.com/nvsukhanov/rxpoweredup/blob/main/LICENSE)
[![CI Status](https://github.com/nvsukhanov/rxpoweredup/actions/workflows/ci.yml/badge.svg)](https://github.com/nvsukhanov/rxpoweredup/actions)
[![NPM Version](https://img.shields.io/npm/v/rxpoweredup.svg?style=flat)](https://www.npmjs.com/package/rxpoweredup)

A light-weight Typescript RxJS-based library for controlling LEGO Powered UP hubs & peripherals using Web Bluetooth API.

Documentation can be found [here](https://nvsukhanov.github.io/rxPoweredUp)

## Disclaimer

LEGO® is a trademark of the LEGO Group of companies which does not sponsor, authorize or endorse this application.

## Examples

Following examples use experimental navigator.bluetooth browser API to connect to Bluetooth devices, which is not yet
fully supported by all browsers.
Web Bluetooth API is not available in Node.js, however, it may be possible to use libraries which provide similar API.

### Reactive

```typescript
connectHub(navigator.bluetooth)
  .pipe(
    // connect to the first available hub
    audit((hub) => hub.ports.onIoAttach(0)), // wait for the first device to be attached to port 0
    switchMap((hub) =>
      concat(
        hub.motors.setSpeed(0, 100), // set motor speed to 100
        timer(1000), // wait for 1 second
        hub.motors.setSpeed(0, 0), // stop motor
        hub.disconnect() // disconnect from the hub
      )
    )
  )
  .subscribe();
```

### Async

```typescript
const hub = await firstValueFrom(connectHub(navigator.bluetooth));
await firstValueFrom(hub.ports.onIoAttach(0));
await lastValueFrom(hub.motors.setSpeed(0, 100));
await lastValueFrom(timer(1000));
await lastValueFrom(hub.motors.setSpeed(0, 0));
await lastValueFrom(hub.disconnect());
```

More examples can be found [here](https://github.com/nvsukhanov/rxPoweredUp/tree/main/apps/examples)

---
_Source: https://npm.io/package/rxpoweredup · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
