simplest-timer
v1.0.1
Published
`simplest-timer` is a really simple timer utility. you can timeout, pause, stop and repeat a timer.
Downloads
10
Readme
# simplest-timer
simplest-timer
is a really simple timer utility. you can timeout, pause, stop and repeat a timer.
installation
npm install --save simplest-timer
usage
create an instance of simplestTimer:
const simplestTimer = require('simplest-timer')
.timeout
runs a function after a given duration.
const callbackFn = () => console.log('hey!')
const duration = 100
simplestTimer.timeout(callbackFn, duration)
.stop
stops a current timer.
simplestTimer.timeout(callbackFn, duration)
simplestTimer.stop()
.interval
runs a function repeatedly at a given interval.
const callbackFn = () => console.log('hey!')
const duration = 100
simplestTimer.interval(callbackFn, duration)