Skip to content

시작하기

GitHub

설치

설치

Capgo AI-assisted 설치를 사용하여 플러그인을 설치할 수 있습니다. AI 도구에 다음 명령어를 사용하여 Capgo 기능을 추가하세요.

터미널 창
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins

다음 명령어를 사용하여 __CAPGO_KEEP_0__ 기능을 추가하세요.

Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-volume-buttons` plugin in my project.

만약 Capgo AI-assisted 설치 대신 수동 설치를 원한다면, 다음 명령어를 실행하고 아래의 플랫폼별 지침을 따르세요.

터미널 창
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__ 제거

이 플러그인의 모든 리스너를 제거합니다.

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';

Source Of Truth src/definitions.ts. API을 다시同步할 때 upstream의 API이 변경되면 다시 실행하세요.

시작하기에서 계속

시작하기에서 계속

만약 __CAPGO_KEEP_0__을 사용하고 있다면 시작하기 API을 사용하여 API 및 __CAPGO_KEEP_1__ 연산을 계획하고 API을 연결하세요. @capgo/capacitor-volume-buttons을 사용하여 capgo native capgo을 사용하여 @capgo/capacitor-volume-buttons을 사용하는 경우 API API __CAPGO_KEEP_0__ __CAPGO_KEEP_0__ API 키 API 키의 구현 세부 정보를 위해 __CAPGO_KEEP_0__ __CAPGO_KEEP_0__의 구현 세부 정보를 위해