Skip to content

anandsuresh/smart-timer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm (scoped) Travis npm

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

About

A smart timer implementation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published