An open API service indexing awesome lists of open source software.

https://github.com/tim-smart/torch

A library to turn on/off a smartphone flash.
https://github.com/tim-smart/torch

Last synced: about 1 year ago
JSON representation

A library to turn on/off a smartphone flash.

Awesome Lists containing this project

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.

```typescript
export declare class Torch {
setup(): Promise;

toggle(enableFlash?: boolean): Promise;
on(): Promise;
off(): Promise;
stop(): void;
}
export declare function createTorch(): Promise;
```

## Usage

```typescript
import { createTorch } from "@tim-smart/torch";

(async () => {
const torch = await createTorch();
await torch.on();
setTimeout(() => torch.stop(), 5000);
})();
```