# react-power-timers

> Renderless timers

Latest version **0.1.0** (published 2018-06-10) · 0 weekly downloads

## Install

```sh
npm install react-power-timers
pnpm add react-power-timers
yarn add react-power-timers
bun add react-power-timers
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2018-06-10 |
| First published | 2018-06-09 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8.5.0 |
| Dependencies | 1 |
| Unpacked size | 12.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 27 |
| Author | Anton Korzunov |
| Maintainers | kashey |
| Keywords | timer, renderprop |

## Links

- npm: https://www.npmjs.com/package/react-power-timers
- Repository: https://github.com/theKashey/react-power-timers
- Homepage: https://github.com/theKashey/react-power-timers#readme
- Issues: https://github.com/theKashey/react-power-timers/issues
- npm.io page: https://npm.io/package/react-power-timers

## Dependencies (1)

- [prop-types](https://npm.io/package/prop-types.md) ^15.6.1

## Recent versions

- 0.1.0 (latest) — 2018-06-10
- 0.0.2 — 2018-06-09
- 0.0.1 — 2018-06-09

## README

⏰ React-Power-Timers
======
Renderless timers and intervals. For delayed rendering, and animation orchestration.


# API

1. `Timeout` - Timer, which will execute only once.
```js
import {Timeout} from 'react-power-timers';

<Timeout timeout={1000} then={doSomething}/>

<Timeout timeout={1000}>
 { timedout => timedout && <RenderSomething />}
</Timeout>
```

2. `Interval` - Periodical timer
```js
import {Interval} from 'react-power-timers';

<Interval delay={1000} onTick={tick => doSomething(tick)}/>

<Interval delay={1000}>
 { tick => <span>#{tick}</span> }
</Interval> 
```

3. `Stopwatch` - Continuous progress tracker, counting from 0 to 1.
Based of request animation frame, could be used for animations.
```js
import {Stopwatch} from 'react-power-timers';

<Stopwatch timeout={1000} onTick={progress => doSomething(progress)}/>

<Stopwatch timout={1000}>
 { progress => <span>#{Math.round(100*progress)}</span> }
</Stopwatch> 
```

# Power usage

```js
import {Value} from 'react-powerplug';
import {Timeout} from 'react-power-timers';

<Value initial={0}>
 {({value, set}) => (
   <React.Fragment>
     { value === 0 && <Timeout timeout={100} then={() => set(1)}/>}
     { value === 1 && <Timeout timeout={100} then={() => set(2)}/>}
     { value === 2 && <Timeout timeout={100} then={() => set(0)}/>}
     
     <div> current phase is {value}</div>
   </React.Fragment>
 )}
</Value> 
```

# Licence
 MIT

---
_Source: https://npm.io/package/react-power-timers · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
