Using @capgo/capacitor-flash
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/
Keep going from Using @capgo/capacitor-flash
__CAPGO_KEEP_0__을 사용하여 대시보드와 __CAPGO_KEEP_0__ 작업을 계획하고 있다면 Using @capgo/capacitor-flash API 플러그인을 사용하여 대시보드와 API 작업을 계획하고 있다면 @capgo/capacitor-flash for the implementation detail in @capgo/capacitor-flash, 시작하기 Capacitor 플래시 구현 세부 사항에 대해 API Overview for the implementation detail in API Overview, Capacitor 플래시 구현 세부 사항에 대해, 그리고 Capacitor 플래시 키 API Keys for the implementation detail in API Keys.