# universal-accelerometer

> Accelerometer monitor and cancel.

Latest version **1.0.1** (published 2019-12-16) · 0 weekly downloads

## Install

```sh
npm install universal-accelerometer
pnpm add universal-accelerometer
yarn add universal-accelerometer
bun add universal-accelerometer
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-12-16 |
| First published | 2019-11-21 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | rax |
| Maintainers | balloonzzq, rax-publisher |
| Keywords | Rax |

## Links

- npm: https://www.npmjs.com/package/universal-accelerometer
- npm.io page: https://npm.io/package/universal-accelerometer

## Dependencies (1)

- [universal-env](https://npm.io/package/universal-env.md) ^2.0.0

## Recent versions

- 1.0.1 (latest) — 2019-12-16
- 2.0.0-beta (beta) — 2021-01-12
- 1.0.0-beta.1 — 2019-11-21

## README

# universal-accelerometer [![npm](https://img.shields.io/npm/v/universal-accelerometer.svg)](https://www.npmjs.com/package/universal-accelerometer)

Accelerometer monitor and cancel.

## Support
<img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /> <img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px">

## Install

```bash
$ npm install universal-accelerometer --save
```

## Methods

### `onChange(callback): void`

Monitoring acceleration data, the callback interval is 500ms, the interface calls will automatically start listening, can use offChange() to stop listening.

#### Parameters
| Property | Type     | Description   | Support |
| -------- | -------- | ------------- | :-----: |
| callback | `Function` | The callback function | <img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /> <img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px">  |

### `offChange(): void`

Stop listening for acceleration data.

## Example

```js
import Accelerometer from 'universal-accelerometer';

Accelerometer.onChange(res => {
  console.log(res.x);
  console.log(res.y);
  console.log(res.z);
});

Accelerometer.offChange();
```

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