Socket
Book a DemoInstallSign in
Socket

every

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

every

an event emitter for integer-based millisecond steps

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

every

an event emitter for integer-based millisecond steps.


var every = require('every')

every(33)
  .on('data', function(dt) {
    console.log(dt) // will always be a multiple of 33  
  })

api

timer = every(ms[, installTimer, uninstallTimer, now])

create an event emitter that emits every ms.

optionally provide your own install / uninstall functions for timers.

install functions are expected to return a handle which will then be given to the uninstall function when the timer is destroyed.

you may also provide your own now function -- it defaults to Date.now().

timer.paused() -> Boolean

returns whether or not the timer is paused.

timer.pause()

pauses the timer. the timer will not emit events while paused.

timer.resume()

resumes the timer. the timer will start emitting events again. it will not emit the difference between pause and resume on the next step.

timer.rate() -> currentRateMS

emit the current rate in milliseconds.

timer.rate(rate) -> currentRateMS

set the current rate in milliseconds.

timer.destroy()

uninstalls the timer function.

license

MIT

Keywords

timer

FAQs

Package last updated on 19 Feb 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts