메뉴로 바로가기

시작하기

설치

설치
터미널 창
bun add @capgo/capacitor-flash
bunx cap sync

Import

Import
import { CapacitorFlash } from '@capgo/capacitor-flash';

__CAPGO_KEEP_0__가 장치에 있는지 확인합니다.

import { CapacitorFlash } from '@capgo/capacitor-flash';
const { value } = await CapacitorFlash.isAvailable();
if (value) {
console.log('Flashlight is available');
}

__CAPGO_KEEP_1__를 켭니다.

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 });

__CAPGO_KEEP_2__를 끕니다.

import { CapacitorFlash } from '@capgo/capacitor-flash';
await CapacitorFlash.switchOff();

isSwitchedOn

isSwitchedOn

flashlight가 현재 켜져 있는지 확인합니다.

import { CapacitorFlash } from '@capgo/capacitor-flash';
const { value } = await CapacitorFlash.isSwitchedOn();
console.log('Flashlight is on:', value);

toggle

toggle

flashlight를 켜거나 끕니다.

import { CapacitorFlash } from '@capgo/capacitor-flash';
const { value } = await CapacitorFlash.toggle();
console.log('Flashlight toggled, now on:', value);

public __CAPGO_KEEP_0__이 업스트림에서 변경될 때 다시 싱크를 실행하세요. src/definitions.ts. Re-run the sync when the public API changes upstream.