Mulai
Copy sebuah 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-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.
Pasang
Bagian berjudul “Pasang”bun add @capgo/capacitor-volume-buttonsbunx cap syncImpor
Judul Bagian “Impor”import { VolumeButtons } from '@capgo/capacitor-volume-buttons';API Ringkasan
Judul Bagian “API Ringkasan”addListener
Judul Bagian “tambahkanPembangkit”Tetapkan untuk mendengar tekanan pada tombol volume keras.
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
Judul Bagian “hapusSemuaPembangkit”Menghapus semua pembangkit untuk plugin ini.
import { VolumeButtons } from '@capgo/capacitor-volume-buttons';
await VolumeButtons.removeAllListeners();getPluginVersion
Judul Bagian “getPluginVersi”Dapatkan versi plugin native Capacitor.
import { VolumeButtons } from '@capgo/capacitor-volume-buttons';
const { version } = await VolumeButtons.getPluginVersion();console.log('Plugin version:', version);Referensi Tipe
Bagian berjudul “Referensi Tipe”VolumeButtonListener
Bagian berjudul “VolumeButtonListener”Fungsi pendengar untuk kejadian tombol volume.
export type VolumeButtonListener = (event: VolumeButtonPressed) => void;VolumeButtonPressed
Bagian berjudul “VolumeButtonPressed”Data kejadian untuk tekan tombol volume.
export interface VolumeButtonPressed { /** Direction of the button press */ direction: VolumeButtonDirection;}VolumeButtonDirection
Bagian berjudul “VolumeButtonDirection”Arah tekanan tombol volume.
export type VolumeButtonDirection = 'up' | 'down';Sumber Kebenaran
Judul bagian “Sumber Kebenaran”Halaman ini dihasilkan dari plugin’s src/definitions.tsRe-run sinkronisasi ketika publik API berubah di atas