0.1.4 • Published 4 years ago

react-random-interval-hook v0.1.4

Weekly downloads
13
License
MIT
Repository
github
Last release
4 years ago

Random Interval Hook

Make an interval with random time delay specified with min and max delay between each call.

Installation

Using npm:

npm install react-random-interval-hook

Using yarn:

yarn add react-random-interval-hook  

Exmaple

import useRandomInterval from "react-random-interval-hook";

const interval = useRandomInterval((stop) => {
  // do what you want
  
  if (stopCondition) {
    stop();
  }
}, 1000, 2000); // interval between 1000 and 2000 ms

stop method also returns by the hook, you can stop interval manually like this.

if(stopCondition)
  interval.stop();

License

MIT

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago