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.
- Host: GitHub
- URL: https://github.com/tim-smart/torch
- Owner: tim-smart
- Created: 2018-12-14T04:36:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-14T04:39:39.000Z (over 7 years ago)
- Last Synced: 2025-02-14T08:51:28.924Z (over 1 year ago)
- Language: TypeScript
- Size: 59.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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);
})();
```