@tim-smart/torch

1.0.1 • Public • Published

@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);
})();

Readme

Keywords

Package Sidebar

Install

npm i @tim-smart/torch

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

4.31 kB

Total Files

7

Last publish

Collaborators

  • tim-smart