Skip to content

시작하기

터미널 창
bun add @capgo/capacitor-volume-buttons
bunx cap sync
import { VolumeButtons } from '@capgo/capacitor-volume-buttons';

API 개요

API 개요

하드웨어 볼륨 버튼의 클릭을 감지합니다.

import { VolumeButtons } from '@capgo/capacitor-volume-buttons';
const listener = await VolumeButtons.addListener(
'volumeButtonPressed',
(event) => {
console.log(`Volume ${event.direction} button pressed`);
}
);
// Remove listener when done
await listener.remove();

removeAllListeners

__CAPGO_KEEP_0__ 제거

__CAPGO_KEEP_0__ 플러그인에 대한 모든 리스너를 제거합니다.

import { VolumeButtons } from '@capgo/capacitor-volume-buttons';
await VolumeButtons.removeAllListeners();

Capacitor 플러그인의 네이티브 버전을 가져옵니다.

import { VolumeButtons } from '@capgo/capacitor-volume-buttons';
const { version } = await VolumeButtons.getPluginVersion();
console.log('Plugin version:', version);

타입 참조

타입 참조

VolumeButtonListener

볼륨 버튼 리스너

볼륨 버튼 이벤트에 대한 리스너 함수입니다.

export type VolumeButtonListener = (event: VolumeButtonPressed) => void;

VolumeButtonPressed

볼륨 버튼 눌림

볼륨 버튼 누름에 대한 이벤트 데이터입니다.

export interface VolumeButtonPressed {
/** Direction of the button press */
direction: VolumeButtonDirection;
}

VolumeButtonDirection

볼륨 버튼 방향

볼륨 버튼 누름 방향입니다.

export type VolumeButtonDirection = 'up' | 'down';

진실의 근원

진실의 근원

이 페이지는 플러그인의 소스 코드에서 생성됩니다. src/definitions.ts. API이 업스트림에서 변경될 때 다시 싱크를 실행하세요.