@capgo/capacitor-플래시 사용
Capacitor 플래시 플러그인: 장치의 플래시등/토치등을 제어합니다.
설치
bun add @capgo/capacitor-flash
bunx cap sync
이 플러그인이 제공하는 것
isAvailable- 장치에 플래시가 사용 가능한지 확인합니다.switchOn- 플래시를 켭니다.switchOff- 플래시를 끕니다.isSwitchedOn- 플래시가 현재 켜져 있는지 끌어져 있는지 확인합니다.
예시 사용
isAvailable
플래시가 장치에 사용 가능한지 확인합니다.
import { CapacitorFlash } from '@capgo/capacitor-flash';
const { value } = await CapacitorFlash.isAvailable();
if (value) {
console.log('Flashlight is available');
}
switchOn
등을 켭니다.
import { CapacitorFlash } from '@capgo/capacitor-flash';
// Turn on at full brightness
await CapacitorFlash.switchOn({ intensity: 1.0 });
// Turn on at half brightness
await CapacitorFlash.switchOn({ intensity: 0.5 });
switchOff
등을 끕니다.
import { CapacitorFlash } from '@capgo/capacitor-flash';
await CapacitorFlash.switchOff();
isSwitchedOn
등이 켜져 있는지 끄여져 있는지 확인합니다.
import { CapacitorFlash } from '@capgo/capacitor-flash';
const { value } = await CapacitorFlash.isSwitchedOn();
console.log('Flashlight is on:', value);
전체 참조
- GitHub: https://github.com/Cap-go/capacitor-flash/
- 문서: /docs/plugins/flash/
Using @capgo/capacitor-flash
이미 @capgo/capacitor-flash 대시보드를 계획하고 API 작업을 연결하려면 @capgo/capacitor-flash for the implementation detail in @capgo/capacitor-flash, Getting Started for the implementation detail in Getting Started, API 개요 for the implementation detail in API 개요, 인사말 for the implementation detail in 인사말, 그리고 API 키 for the implementation detail in API 키.