https://github.com/cap-go/capacitor-shake
Capacitor Plugin to detect when a physical device performs a shake gesture
https://github.com/cap-go/capacitor-shake
capacitor capacitor-plugin plugin
Last synced: about 2 months ago
JSON representation
Capacitor Plugin to detect when a physical device performs a shake gesture
- Host: GitHub
- URL: https://github.com/cap-go/capacitor-shake
- Owner: Cap-go
- License: mpl-2.0
- Created: 2023-03-10T02:52:26.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2026-02-16T07:15:20.000Z (4 months ago)
- Last Synced: 2026-02-16T14:35:48.232Z (4 months ago)
- Topics: capacitor, capacitor-plugin, plugin
- Language: JavaScript
- Homepage: https://capgo.app
- Size: 1.31 MB
- Stars: 15
- Watchers: 1
- Forks: 2
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Agents: AGENTS.md
Awesome Lists containing this project
README
# @capgo/capacitor-shake
Detect shake gesture in device
## Documentation
The most complete doc is available here: https://capgo.app/docs/plugins/shake/
## Compatibility
| Plugin version | Capacitor compatibility | Maintained |
| -------------- | ----------------------- | ---------- |
| v8.\*.\* | v8.\*.\* | ✅ |
| v7.\*.\* | v7.\*.\* | On demand |
| v6.\*.\* | v6.\*.\* | ❌ |
| v5.\*.\* | v5.\*.\* | ❌ |
> **Note:** The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v8 for Capacitor 8). Only the latest major version is actively maintained.
## Install
```bash
npm install @capgo/capacitor-shake
npx cap sync
```
## API
* [`addListener('shake', ...)`](#addlistenershake-)
* [`getPluginVersion()`](#getpluginversion)
* [Interfaces](#interfaces)
Capacitor Shake Plugin interface for detecting shake gestures on mobile devices.
This plugin allows you to listen for shake events and get plugin version information.
### addListener('shake', ...)
```typescript
addListener(eventName: 'shake', listenerFunc: () => void) => Promise
```
Listen for shake event on the device.
Registers a listener that will be called whenever a shake gesture is detected.
The shake detection uses the device's accelerometer to identify shake patterns.
| Param | Type | Description |
| ------------------ | -------------------------- | --------------------------------------------------- |
| **`eventName`** | 'shake' | The shake change event name. Must be 'shake'. |
| **`listenerFunc`** | () => void | Callback function invoked when the phone is shaken. |
**Returns:** Promise<PluginListenerHandle>
**Since:** 1.0.0
--------------------
### getPluginVersion()
```typescript
getPluginVersion() => Promise<{ version: string; }>
```
Get the native Capacitor plugin version.
Returns the current version of the native plugin implementation.
**Returns:** Promise<{ version: string; }>
**Since:** 1.0.0
--------------------
### Interfaces
#### PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| **`remove`** | () => Promise<void> |
