はじめに
このプラグインのインストール手順と全マークダウンガイドを含む設定の質問をコピーします。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-volume-buttons`
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/volume-buttons/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.
インストール
「インストール」のセクションbun add @capgo/capacitor-volume-buttonsbunx cap syncインポート
「インポート」のセクションimport { VolumeButtons } from '@capgo/capacitor-volume-buttons';APIの概要
APIの概要addListener
__CAPGO_KEEP_0__のリスナーを追加ハードウェアボリュームボタンの押下を検知する
import { VolumeButtons } from '@capgo/capacitor-volume-buttons';
const listener = await VolumeButtons.addListener( 'volumeButtonPressed', (event) => { console.log(`Volume ${event.direction} button pressed`); });
// Remove listener when doneawait listener.remove();removeAllListeners
__CAPGO_KEEP_0__のリスナーをすべて削除このプラグインのすべてのリスナーを削除
import { VolumeButtons } from '@capgo/capacitor-volume-buttons';
await VolumeButtons.removeAllListeners();getPluginVersion
__CAPGO_KEEP_0__プラグインのネイティブバージョンを取得Get the native Capacitor plugin version.
import { VolumeButtons } from '@capgo/capacitor-volume-buttons';
const { version } = await VolumeButtons.getPluginVersion();console.log('Plugin version:', version);__CAPGO_KEEP_0__の型参照
クリップボードにコピーVolumeButtonListener
バツルムボタンホイールリスナーボリュームボタンイベントのリスナー関数
export type VolumeButtonListener = (event: VolumeButtonPressed) => void;VolumeButtonPressed
バツルムボタン押下ボリュームボタン押下のイベントデータ
export interface VolumeButtonPressed { /** Direction of the button press */ direction: VolumeButtonDirection;}VolumeButtonDirection
ボリュームボタンの方向クリップボードにコピー
export type VolumeButtonDirection = 'up' | 'down';This page is generated from the plugin’s src/definitions.ts. upstream の 公開 API が変更されたときに、再度 同期を実行してください。