New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

fixed-setinterval

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

fixed-setinterval

A setInterval replacement that accounts for delays and gives you a delta time as a parameter

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

FixedTimeInterval

Javascript has an awesome function called setInterval. The problem is that that function can delay some seconds or can run erraticaly if there are slow functions running in between calls.

For some applications (such as a gamming update loop) it is desirable to have some properties:

  • A delta time is passed as a parameter indicating how much time has elapsed since the last function call;
  • Some calls could be skipped if they take too much long to be called

That's what this package does in a nutshell. No more, no less.

Usage

function update(delta) {
  console.log(delta);
}
var cancel = setFixedInterval(update, 1000);
// ...
// to clearInterval:
cancel();

Example

See example.html.

Keywords

setinterval

FAQs

Package last updated on 12 Mar 2016

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