ガイド
Flashのチュートリアル
@capgo/capacitor-flash を使用
Capacitor Flash プラグイン: デバイスのフラッシュライト/トーチを制御
Install
bun add @capgo/capacitor-flash
bunx cap sync
What This Plugin Exposes
isAvailable- Checks if flashlight is available on the device.switchOn- Turns the flashlight on.switchOff- Turns the flashlight off.isSwitchedOn- Checks if the flashlight is currently turned on or off.
Example Usage
isAvailable
Checks if flashlight is available on the device.
import { CapacitorFlash } from '@capgo/capacitor-flash';
const { value } = await CapacitorFlash.isAvailable();
if (value) {
console.log('Flashlight is available');
}
switchOn
Turns the flashlight on.
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
Turns the flashlight off.
import { CapacitorFlash } from '@capgo/capacitor-flash';
await CapacitorFlash.switchOff();
isSwitchedOn
Checks if the flashlight is currently turned on or off.
import { CapacitorFlash } from '@capgo/capacitor-flash';
const { value } = await CapacitorFlash.isSwitchedOn();
console.log('Flashlight is on:', value);
Full Reference
- GitHub: https://github.com/Cap-go/capacitor-flash/
- ドキュメント: /docs/plugins/flash/
Capgoを使用し続けるには、@capgo/capacitor-flashを使用してください。
__CAPGO_KEEP_0__を使用している場合 @capgo/capacitor-flashを使用しています APIのダッシュボードと操作を計画する場合、@API/__CAPGO_KEEP_1__-flashと接続してください。 @capgo/capacitor-flashの実装詳細については、@capgo/capacitor-flashを参照してください。 for the implementation detail in @capgo/capacitor-flash, Getting Startedの実装詳細については、Getting Startedを参照してください。 __CAPGO_KEEP_0__の概要 API 実装詳細については API の概要を参照してください。 概要 実装詳細については Introduction を参照してください。 API のキー 実装詳細については API Keys を参照してください。