Skip to main content
Back to plugins
@capgo/capacitor-shake
Tutorial
by github.com/Cap-go

Shake

Detect shake gestures on device for triggering actions like undo or feedback

Guide

Tutorial on Shake

Using @capgo/capacitor-shake

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.

Install

bun add @capgo/capacitor-shake
bunx cap sync

What This Plugin Exposes

  • addListener - Listen for shake event on the device.
  • getPluginVersion - Get the native Capacitor plugin version.

Example Usage

addListener

Listen for shake event on the device.

import { CapacitorShake } from '@capgo/capacitor-shake';

const listener = await CapacitorShake.addListener('shake', () => {
  console.log('Shake detected!');
});

// To remove the listener:
await listener.remove();

getPluginVersion

Get the native Capacitor plugin version.

import { CapacitorShake } from '@capgo/capacitor-shake';

const { version } = await CapacitorShake.getPluginVersion();
console.log('Plugin version:', version);

Full Reference

Keep going from Using @capgo/capacitor-shake

If you are using Using @capgo/capacitor-shake to plan native plugin work, connect it with @capgo/capacitor-shake for the implementation detail in @capgo/capacitor-shake, Getting Started for the implementation detail in Getting Started, Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, and Adding or Updating Plugins for the implementation detail in Adding or Updating Plugins.