Socket
Book a DemoInstallSign in
Socket

logtime-interval

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

logtime-interval

when you would like a timer callback to fire based on the timestamp of the data you are processing - the timestamp of the data when you created the timer

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

Build Status

logtime-interval

When you would like a timer callback to fire based on the timestamp of the data you are processing - the timestamp of the data stream when you created the timer rather than real time.

When you are processing older time series data may need to do a particular action for every one of a specific timespan of data.


// create new manager starting at timestamp 0
var manager = require('logtime-interval')(0);

// create a timeout that should fire when i set the time to >= 1000
manager.setTimeout(function(){
  console.log(i fired!);
},1000)

// it is now 1000 ms since i started
manager.setTime(1000);

// next tick prints
// i fired !

api

module.exports is a function it returns a new object to manager timers.

  • manager

manager.setTime

  • sets the current time and triggers execution of any pending timers

manager.setTimeout

  • just like setTimeout

manager.setInterval

  • just like setInterval

manager.clearTimeout

  • setTimeout returns an id
  • if you pass that id to clearTimeout and it has not been called it will not be called

manager.clearInterval

  • setInterval returns an id
  • if you pass that id to setInterval it will not be called again

FAQs

Package last updated on 08 Apr 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