はじめに
このプラグインのインストール手順とフルマークダウンガイドを含むセットアップの質問をコピーします。
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.
インストール
「インストール」のセクションAIアシスタントセットアップを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを実行してください。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次に、以下のプロンプトを使用してください。
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-shake` plugin in my project.Manualセットアップを使用する場合は、以下のコマンドを実行してください。プラットフォーム固有の指示に従ってください。
bun add @capgo/capacitor-shakebunx cap syncインポート
「インポート」のセクションimport { CapacitorShake } from '@capgo/capacitor-shake';API オーバービュー
API オーバービューaddListener
リスナーを追加デバイス上でシェイクイベントをリスン
シェイクイベントが検知されたときに呼び出されるリスナーを登録します。 シェイク検出は、デバイスの加速度計を使用してシェイクパターンを検出します。
import { CapacitorShake } from '@capgo/capacitor-shake';
const listener = await CapacitorShake.addListener('shake', () => { console.log('Shake detected!');});
// To remove the listener:await listener.remove();getPluginVersion
__CAPGO_KEEP_0__ プラグインのバージョンを取得Capacitor プラグインの実装の現在のバージョンを取得します。
クリップボードにコピー
import { CapacitorShake } from '@capgo/capacitor-shake';
const { version } = await CapacitorShake.getPluginVersion();console.log('Plugin version:', version);__CAPGO_KEEP_0__
「ソース・オブ・トゥルース」このページはプラグインの src/definitions.tsパブリックAPIがアップストリームで変更されたときに、再度同期を実行してください。
「Getting Started」から続けてください。
「Getting Started」から続けてください。「Getting Started」を使用してダッシュボードと__CAPGO_KEEP_0__の作業を計画している場合、__CAPGO_KEEP_0__を 「@__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-shake」 「@API/__CAPGO_KEEP_1__-shake」で使用するネイティブ機能の説明 「@capgo/capacitor-shake」 for the native capability in Using @capgo/capacitor-shake, 「API」の実装詳細 API 導入 導入の実装詳細について API キー API キーの実装詳細について デバイス デバイスの実装詳細について