@tim-smart/torch
v1.0.1
Published
Library to turn on/off the camera flash on phones
Downloads
2
Readme
@tim-smart/torch
A small library to toggle the flash on a smartphone on/off.
API
Use the createTorch
function to create a new Torch
instance and call setup
all in one go.
export declare class Torch {
setup(): Promise<void>;
toggle(enableFlash?: boolean): Promise<void>;
on(): Promise<void>;
off(): Promise<void>;
stop(): void;
}
export declare function createTorch(): Promise<Torch>;
Usage
import { createTorch } from "@tim-smart/torch";
(async () => {
const torch = await createTorch();
await torch.on();
setTimeout(() => torch.stop(), 5000);
})();