6.0.3 • Published 11 months ago
@jiggo/jigra-flash v6.0.3
jigra-flash
Switch the Flashlight / Torch of your device.
Install
npm install @jiggo/jigra-flash
npx jig synciOS
Works out of the box
Android
- Declare permissions in your app's
AndroidManifest.xmlfile
<!-- Permissions: Allows access to flashlight -->
<uses-permission android:name="android.permission.CAMERA" android:maxSdkVersion="23" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<!-- Actual Hardware Features Used-->
<uses-feature android:name="android.hardware.camera.flash" android:required="true" />API
isAvailable()
isAvailable() => anyChecks if flashlight is available
Returns: any
switchOn(...)
switchOn(options: { intensity?: number; }) => anyTurns the flashlight on
| Param | Type |
|---|---|
options | { intensity?: number; } |
Returns: any
switchOff()
switchOff() => anyTurns the flashlight off
Returns: any
isSwitchedOn()
isSwitchedOn() => anyChecks if the flashlight is turned on or off
Returns: any
toggle()
toggle() => anyToggle the flashlight
Returns: any
6.0.3
11 months ago