1.0.1 • Published 4 years ago

@anandsuresh/smart-timer v1.0.1

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

smart-timer

A smart timer uses a timeout and an interval timer to check for timeout events, thereby avoiding excessive timeout checks.

usage

const stream = somehowGetAStream()

const {create} = require('smart_timer')
const timer = create(() => stream.destroy()), {timeout: 5000, interval: 1000})

stream
  .on('data', () => timer.touch())    // keep the timer updated of activity
  .on('end', () => timer.destroy())   // destroy the timer when done
1.0.1

4 years ago

1.0.0

4 years ago