# cordova-plugin-shake

> Cordova Plugin to detect when a physical device performs a shake gesture.

Latest version **0.7.0** (published 2020-01-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install cordova-plugin-shake
pnpm add cordova-plugin-shake
yarn add cordova-plugin-shake
bun add cordova-plugin-shake
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.7.0 |
| Published | 2020-01-02 |
| First published | 2015-04-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 20 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 91 |
| Author | Lee Crossley |
| Maintainers | leecrossley |
| Keywords | cordova, shake, gesture, accelerometer, acceleration, detection, ecosystem:cordova |

## Links

- npm: https://www.npmjs.com/package/cordova-plugin-shake
- Repository: https://github.com/leecrossley/cordova-plugin-shake-detection
- Homepage: https://github.com/leecrossley/cordova-plugin-shake-detection#readme
- Issues: https://github.com/leecrossley/cordova-plugin-shake-detection/issues
- npm.io page: https://npm.io/package/cordova-plugin-shake

## Dependencies (2)

- [fs](https://npm.io/package/fs.md) ^0.0.1-security
- [path](https://npm.io/package/path.md) ^0.12.7

## Recent versions

- 0.7.0 (latest) — 2020-01-02
- 0.6.0 — 2017-06-11
- 0.5.4 — 2016-04-21
- 0.5.3 — 2015-09-11
- 0.5.1 — 2015-04-29
- 0.5.0 — 2015-04-28

## README

# Shake Gesture Detection for Cordova [![npm version](https://badge.fury.io/js/cordova-plugin-shake.svg)](http://badge.fury.io/js/cordova-plugin-shake)

Apache Cordova / PhoneGap Plugin to detect when a physical device performs a shake gesture.

For iOS, the plugin uses the native shake detection.
Fo all other platforms, it is based on a standalone JavaScript implementation I wrote last year ([gist](https://gist.github.com/leecrossley/4078996)).

## Install

Requires Cordova v5.0.0 or above.

### Latest published version on npm

```bash
cordova plugin add cordova-plugin-shake
```

### Latest version from GitHub

```bash
cordova plugin add https://github.com/leecrossley/cordova-plugin-shake.git
```

## Usage

You **do not** need to reference any JavaScript, the Cordova plugin architecture will add a shake object to your root automatically when you build.

**NB:** For non-iOS platforms, there is no native component to this plugin but it depends on the device motion plugin (added when this plugin is added).

## Example

```js
var onShake = function () {
  // Fired when a shake is detected
};

var onError = function () {
  // Fired when there is an accelerometer error (optional)
};

// Start watching for shake gestures and call "onShake"
// with a shake sensitivity of 40 (optional, default 30)
shake.startWatch(onShake, 40 /*, onError */);

// Stop watching for shake gestures
shake.stopWatch();
```

## License

[MIT License](http://ilee.mit-license.org)

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