UNPKG

@capgo/capacitor-flash

Version:

Switch the Flashlight / Torch of your device.

192 lines 5.78 kB
{ "api": { "name": "CapacitorFlashPlugin", "slug": "capacitorflashplugin", "docs": "Capacitor Flash Plugin for controlling device flashlight/torch.", "tags": [ { "text": "1.0.0", "name": "since" } ], "methods": [ { "name": "isAvailable", "signature": "() => Promise<{ value: boolean; }>", "parameters": [], "returns": "Promise<{ value: boolean; }>", "tags": [ { "name": "returns", "text": "Promise that resolves with availability status" }, { "name": "throws", "text": "Error if checking availability fails" }, { "name": "since", "text": "1.0.0" }, { "name": "example", "text": "```typescript\nconst { value } = await CapacitorFlash.isAvailable();\nif (value) {\n console.log('Flashlight is available');\n}\n```" } ], "docs": "Checks if flashlight is available on the device.", "complexTypes": [], "slug": "isavailable" }, { "name": "switchOn", "signature": "(options: { intensity?: number; }) => Promise<void>", "parameters": [ { "name": "options", "docs": "- Optional configuration including light intensity", "type": "{ intensity?: number | undefined; }" } ], "returns": "Promise<void>", "tags": [ { "name": "param", "text": "options - Optional configuration including light intensity" }, { "name": "returns", "text": "Promise that resolves when flashlight is turned on" }, { "name": "throws", "text": "Error if flashlight is not available or turning on fails" }, { "name": "since", "text": "1.0.0" }, { "name": "example", "text": "```typescript\n// Turn on at full brightness\nawait CapacitorFlash.switchOn({ intensity: 1.0 });\n\n// Turn on at half brightness\nawait CapacitorFlash.switchOn({ intensity: 0.5 });\n```" } ], "docs": "Turns the flashlight on.", "complexTypes": [], "slug": "switchon" }, { "name": "switchOff", "signature": "() => Promise<void>", "parameters": [], "returns": "Promise<void>", "tags": [ { "name": "returns", "text": "Promise that resolves when flashlight is turned off" }, { "name": "throws", "text": "Error if turning off fails" }, { "name": "since", "text": "1.0.0" }, { "name": "example", "text": "```typescript\nawait CapacitorFlash.switchOff();\n```" } ], "docs": "Turns the flashlight off.", "complexTypes": [], "slug": "switchoff" }, { "name": "isSwitchedOn", "signature": "() => Promise<{ value: boolean; }>", "parameters": [], "returns": "Promise<{ value: boolean; }>", "tags": [ { "name": "returns", "text": "Promise that resolves with the current flashlight state" }, { "name": "throws", "text": "Error if checking state fails" }, { "name": "since", "text": "1.0.0" }, { "name": "example", "text": "```typescript\nconst { value } = await CapacitorFlash.isSwitchedOn();\nconsole.log('Flashlight is on:', value);\n```" } ], "docs": "Checks if the flashlight is currently turned on or off.", "complexTypes": [], "slug": "isswitchedon" }, { "name": "toggle", "signature": "() => Promise<{ value: boolean; }>", "parameters": [], "returns": "Promise<{ value: boolean; }>", "tags": [ { "name": "returns", "text": "Promise that resolves with the new flashlight state" }, { "name": "throws", "text": "Error if toggling fails" }, { "name": "since", "text": "1.0.0" }, { "name": "example", "text": "```typescript\nconst { value } = await CapacitorFlash.toggle();\nconsole.log('Flashlight toggled, now on:', value);\n```" } ], "docs": "Toggle the flashlight on or off.", "complexTypes": [], "slug": "toggle" }, { "name": "getPluginVersion", "signature": "() => Promise<{ version: string; }>", "parameters": [], "returns": "Promise<{ version: string; }>", "tags": [ { "name": "returns", "text": "Promise that resolves with the plugin version" }, { "name": "throws", "text": "Error if getting the version fails" }, { "name": "since", "text": "1.0.0" }, { "name": "example", "text": "```typescript\nconst { version } = await CapacitorFlash.getPluginVersion();\nconsole.log('Plugin version:', version);\n```" } ], "docs": "Get the native Capacitor plugin version.", "complexTypes": [], "slug": "getpluginversion" } ], "properties": [] }, "interfaces": [], "enums": [], "typeAliases": [], "pluginConfigs": [] }