Mulai
Salin prompt pengaturan dengan langkah instalasi dan panduan markdown lengkap untuk plugin ini.
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.
Instalasi
Judul bagian “Instalasi”bun add @capgo/capacitor-shakebunx cap syncImpor
Judul bagian “Impor”import { CapacitorShake } from '@capgo/capacitor-shake';API Pengantar
Judul bagian “API Pengantar”addListener
Bagian berjudul “addListener”Tetapkan perangkat untuk mendengar event goncangan.
Mendaftarkan seorang pendengar yang akan dipanggil setiap kali pola gerakan goncangan terdeteksi. Deteksi goncangan menggunakan akselerometer perangkat untuk mengidentifikasi pola goncangan.
import { CapacitorShake } from '@capgo/capacitor-shake';
const listener = await CapacitorShake.addListener('shake', () => { console.log('Shake detected!');});
// To remove the listener:await listener.remove();getPluginVersion
Bagian berjudul “getPluginVersion”Dapatkan versi native Capacitor plugin.
Mengembalikan versi saat ini dari implementasi plugin native.
import { CapacitorShake } from '@capgo/capacitor-shake';
const { version } = await CapacitorShake.getPluginVersion();console.log('Plugin version:', version);Sumber Kebenaran
Bagian berjudul “Sumber Kebenaran”Halaman ini dihasilkan dari plugin’s. src/definitions.tsRe-run sinkronisasi ketika perubahan publik API terjadi di atas.