npm i --save @angelengineering/flashlight
- Version: 1.1.0
- GitHub: https://github.com/AngelEngineering/nativescript-plugins
- NPM: https://www.npmjs.com/package/%40angelengineering%2Fflashlight
- Downloads:
- Last Day: 0
- Last Week: 0
- Last Month: 0
@angelengineering/flashlight
Nativescript flashlight
This plugin allows you to enable/disable the flashlight/torch on your iOS/Android device.
ns plugin add @angelengineering/flashlight
Usage
The best way to explore the usage of the plugin is to inspect the demo app in the plugin repository.
In apps/demo
folder you can find the usage of the plugin for TypeScript non-Angular application. Refer to apps/demo/src/plugin-demos/flashlight.ts
.
In short here are the steps:
Import the plugin
TypeScript
import { Flashlight } from '@angelengineering/flashlight';
Create filepicker instance
TypeScript
Flashlight.isOn; //boolean
Flashlight.isAvailable; //boolean
Flashlight.toggle(); //boolean
Flashlight.enable(); //boolean
Flashlight.disable(); //boolean
Important Note
In general, this util should not be used when an application is using the camera ( video preview, photo taking, video recording, etc. ) as it will throw an error trying to control the flashlight at the same time that the camera hardware is active.
License
Apache License Version 2.0