Getting Started
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.
Install
Bagian berjudul “Install”Kamu bisa menggunakan Setup Bantuan AI kami untuk menginstal plugin ini. Tambahkan Capgo kemampuan ke alat AI kamu menggunakan perintah berikut:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsLalu gunakan prompt berikut:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-volume-buttons` plugin in my project.Jika kamu lebih suka Setup Manual, instal plugin dengan menjalankan perintah-perintah berikut dan ikuti instruksi spesifik platform di bawah ini:
bun add @capgo/capacitor-volume-buttonsbunx cap syncimport { VolumeButtons } from '@capgo/capacitor-volume-buttons';Ringkasan API
Judul Bagian “API Pengantar”addListener
Judul Bagian “Tambahkan Pemangku Jawab”Dengarkan 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 “Hapus Semua Pemangku Jawab”Menghapus semua pemangku jawab untuk plugin ini.
import { VolumeButtons } from '@capgo/capacitor-volume-buttons';
await VolumeButtons.removeAllListeners();getPluginVersion
Judul Bagian “Dapatkan Versi Plugin Asli”Dapatkan versi plugin native Capacitor.
import { VolumeButtons } from '@capgo/capacitor-volume-buttons';
const { version } = await VolumeButtons.getPluginVersion();console.log('Plugin version:', version);Referensi Tipe
Judul Bagian “Referensi Tipe”VolumeButtonListener
Judul Bagian “VolumeButtonListener”Fungsi pembarui untuk peristiwa tombol volume.
export type VolumeButtonListener = (event: VolumeButtonPressed) => void;VolumeButtonPressed
Judul Bagian “VolumeButtonPressed”Data peristiwa untuk menekan tombol volume.
export interface VolumeButtonPressed { /** Direction of the button press */ direction: VolumeButtonDirection;}VolumeButtonDirection
Judul Bagian “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.
Teruskan dari Getting Started
Bab berjudul “Teruskan dari Getting Started”Jika Anda menggunakan Getting Started untuk merencanakan dashboard dan API operasi, hubungkannya dengan Menggunakan @capgo/capacitor-volume-buttons untuk kemampuan asli di Menggunakan @capgo/capacitor-volume-buttons, API Ringkasan untuk detail implementasi di API Ringkasan, Pendahuluan untuk detail implementasi di Pendahuluan, Kunci API untuk detail implementasi di Kunci API Perangkat untuk detail implementasi di Perangkat.