# noble_base

> Typescript compatible Noble base class for manipulating BLE peripheral devices

Latest version **1.0.5** (published 2018-08-19) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2018-08-19 |
| First published | 2017-09-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8.11.0 |
| Dependencies | 1 |
| Unpacked size | 98.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Michal Lower |
| Maintainers | keton |
| Keywords | Noble, BLE, typescript |

## Links

- npm: https://www.npmjs.com/package/noble_base
- Repository: https://github.com/keton/noble_base
- Homepage: https://github.com/keton/noble_base#readme
- Issues: https://github.com/keton/noble_base/issues
- npm.io page: https://npm.io/package/noble_base

## Dependencies (1)

- [noble](https://npm.io/package/noble.md) ^1.9.1

## 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

- 1.0.5 (latest) — 2018-08-19
- 1.0.4 — 2017-09-22
- 1.0.3 — 2017-09-19
- 1.0.1 — 2017-09-18
- 1.0.0 — 2017-09-18

## README

# noble_base
Typescript compatible Noble base class for manipulating BLE peripheral devices

## Install
```
npm install noble_base
```

## Usage
Take a look at the `src/examples`. Basic pattern is as follows:
1. Extend `NobleBase.Base` class
    ```typescript
    class ExamplePeripheral extends NobleBase.Base {
      public is(peripheral: Noble.Peripheral): boolean {
          //return true if you want connect to this peripheral
      }

      protected async onConnectAndSetupDone() {
          //do something when peripheral is connected
      }
    }
    ```
1. Implement `is()` and `onConnectAndSetupDone()` methods
1. In your application code instantiate ScanHelper for your child class
    ```typescript
    let scanHelper = new NobleBase.ScanHelper<ExamplePeripheral>(ExamplePeripheral);
    ```
1. (optional) Apply scan filter
    ```typescript
    scanHelper.setScanFilter((peripheral) => {
        //return true if peripheral should be connected
    });
    ```
1. (optional) Attach device discovered callback
    ```typescript
        //called each time new SimplePeripheral is connected
        const deviceDiscoveredCallback = (peripheral: ExamplePeripheral) => {
            //do something with peripheral
        }
        scanHelper.on('discoveredDevice', deviceDiscoveredCallback);
    ```
1. Start scanning
    ```typescript
    scanHelper.discoverAll();
    ```
1. Done!

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