# use-pulse

> A React hook to spit out a sequential value at a time interval for a given number of times.

Latest version **1.0.2** (published 2020-01-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install use-pulse
pnpm add use-pulse
yarn add use-pulse
bun add use-pulse
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-01-24 |
| First published | 2019-12-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 12.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | samirdamle |
| Maintainers | samirdamle |

## Links

- npm: https://www.npmjs.com/package/use-pulse
- Repository: https://github.com/samirdamle/use-pulse
- Homepage: https://github.com/samirdamle/use-pulse#readme
- Issues: https://github.com/samirdamle/use-pulse/issues
- npm.io page: https://npm.io/package/use-pulse

## Recent versions

- 1.0.2 (latest) — 2020-01-24
- 1.0.1 — 2020-01-24
- 1.0.0 — 2019-12-15

## README

# use-pulse

> A React hook to spit out a sequential value at a time interval for a given number of times.

[![NPM](https://img.shields.io/npm/v/use-pulse.svg)](https://www.npmjs.com/package/use-pulse) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```bash
npm install --save use-pulse
```

## Usage

```jsx
import React, { Component } from 'react'
import { usePulse } from 'use-pulse'

const Example = () => {

        const min = 0           // value to start at
        const max = 100         // value to end at
        const increment = 1     // increment added at every pulse
        const interval = 1000   // pulse interval in milliseconds
        const delay = 500       // delay in milliseconds before first increment
        
        const myPulse = usePulse(min, max, increment, interval, delay)
        // This will create a pulse that will count from min = 0 to max = 100 (inclusive of both ends)
        // with increment = 1 after an initial delay = 500 milliseconds and at an interval = 1000 miliseconds.

        // To start the pulse
        // myPulse.start()

        // To pause or stop the pulse
        // myPulse.stop()

        // To reset the pulse value back to min and stop there
        // myPulse.reset()

        // To restart the pulse from the current value
        // myPulse.start()

        // To get the current value of the pulse
        // myPulse.value

        return (
            <div>
                <div>Pulse Value: {myPulse.value}</div>
                <div>
                    <button onClick={myPulse.reset}>Reset</button>
                    <button onClick={myPulse.start}>Start</button>
                    <button onClick={myPulse.stop}>Stop</button>
                </div>
            </div>
        )
}
```

## License

MIT © [samirdamle](https://github.com/samirdamle)

---

This hook is created using [create-react-hook](https://github.com/hermanya/create-react-hook).

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