开始入门
复制一个包含安装步骤和本插件的完整 Markdown 指南的配置提示。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-flash`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/flash/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Install
Section titled “Install”bun add @capgo/capacitor-flashbunx cap syncImport
Section titled “Import”import { CapacitorFlash } from '@capgo/capacitor-flash';API 简介
API 简介标题isAvailable
__CAPGO_KEEP_0__ 判断判断设备上是否有闪光灯功能。
import { CapacitorFlash } from '@capgo/capacitor-flash';
const { value } = await CapacitorFlash.isAvailable();if (value) { console.log('Flashlight is available');}switchOn
__CAPGO_KEEP_0__ 开启开启闪光灯。
import { CapacitorFlash } from '@capgo/capacitor-flash';
// Turn on at full brightnessawait CapacitorFlash.switchOn({ intensity: 1.0 });
// Turn on at half brightnessawait CapacitorFlash.switchOn({ intensity: 0.5 });switchOff
__CAPGO_KEEP_0__ 关闭关闭闪光灯。
import { CapacitorFlash } from '@capgo/capacitor-flash';
await CapacitorFlash.switchOff();isSwitchedOn
__CAPGO_KEEP_0__ 判断状态检查手电筒是否处于开启或关闭状态.
import { CapacitorFlash } from '@capgo/capacitor-flash';
const { value } = await CapacitorFlash.isSwitchedOn();console.log('Flashlight is on:', value);toggle
标题:切换切换手电筒开启或关闭.
import { CapacitorFlash } from '@capgo/capacitor-flash';
const { value } = await CapacitorFlash.toggle();console.log('Flashlight toggled, now on:', value);真实数据来源
标题:真实数据来源本页面由插件生成 src/definitions.ts. 当公共 API 上游发生变化时,请重新运行同步.
从开始入门继续
标题:从开始入门继续如果您正在使用 开始使用 为了计划仪表板和API操作,连接它与 使用@capgo/capacitor-flash 对于在使用@capgo/capacitor-flash中的本机功能 API概述 对于在API概述中的实现细节 介绍 对于在介绍中的实现细节 API密钥 对于在API密钥中的实现细节 设备 对于在设备中的实现细节.