Avvio
Copia un prompt di configurazione con i passaggi di installazione e la guida markdown completa per questo plugin.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-shake`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/shake/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Installa
Sezione intitolata “Installa”bun add @capgo/capacitor-shakebunx cap syncImporta
Sezione intitolata “Importa”import { CapacitorShake } from '@capgo/capacitor-shake';API Panoramica
Sezione intitolata “API Panoramica”addListener
Sezione intitolata “addListener”Ascolta l'evento di scuotimento sul dispositivo.
Registra un ascoltatore che verrà chiamato ogni volta che viene rilevato un gesto di scuotimento. La rilevazione dello scuotimento utilizza l'accelerometro del dispositivo per identificare i modelli di scuotimento.
import { CapacitorShake } from '@capgo/capacitor-shake';
const listener = await CapacitorShake.addListener('shake', () => { console.log('Shake detected!');});
// To remove the listener:await listener.remove();getPluginVersion
Sezione intitolata “getPluginVersion”Ottieni la versione nativa del plugin Capacitor.
Restituisce la versione corrente dell'implementazione del plugin nativo.
import { CapacitorShake } from '@capgo/capacitor-shake';
const { version } = await CapacitorShake.getPluginVersion();console.log('Plugin version:', version);Fonte di Verità
Sezione intitolata “Fonte di Verità”Questa pagina è generata dal plugin src/definitions.tsRiepiloga quando le modifiche pubbliche API sono state apportate in fase di sviluppo.