@sjblurton/use-timeout
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

useTimeout

useTime takes 2 arguments, the first is the function you would like to run after the the delay, the second is the delay in milliseconds. It returns a object with clear, and rest functions to clear, or reset the timeout.

To install the hook...

npm i @sjblurton/use-timeout

yarn add @sjblurton/use-timeout

To call the hook...

const { clear, reset } = useTimeout(() => callback(), 1000)

To clear timeout...

clear()

To reset timeout...

reset()

links

GitHub Repo: https://github.com/sjblurton/use-timeout
NPM: https://www.npmjs.com/package/@sjblurton/use-timeout

Package Sidebar

Install

npm i @sjblurton/use-timeout

Weekly Downloads

0

Version

0.1.3

License

MIT

Unpacked Size

12.3 kB

Total Files

15

Last publish

Collaborators

  • sjblurton