
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
@ircam/ticker
Advanced tools
Execute a given callback at periodic interval, trying to minimize drift and jitter
Execute a given callback at periodic interval, trying to minimize drift and jitter.
npm install [--save] @ircam/ticker
import Ticker from '@ircam/ticker'
const period = 50; // in milliseconds
const ticker = new Ticker(period, (logicalTime, currentTime, error) => {
console.log(logicalTime, currentTime, error);
});
ticker.start();
Precise periodic timer (based on setTimeout
) that monitor and adapt itself
to stay close to the given therical period. In particular, try to minimize
the drift caused by the use of a raw setTimeout
.
Observed average jitter is around +/- 2ms.
Kind: global class
Param | Type | Description |
---|---|---|
period | Number | period of the timer interval in milliseconds (floored if float is given) |
callback | TickerCallback | callback to execute on each tick |
options | Object | additionnal options |
[options.errorThreshold] | Number | Threshold error where the timer considers itself as out of bounds. Increasing this value tends to increase the overall jitter. |
Number
Period of the timer. Must be an integer, the given value is floored. When updated the new value is applied at the next tick.
Kind: instance property of Ticker
Start the ticker instance.
Kind: instance method of Ticker
Stop the ticker instance.
Kind: instance method of Ticker
function
Kind: global typedef
Param | Type | Description |
---|---|---|
logicalTime | Number | logical time since start in ms |
currentTime | Number | current time as returned by performance.now |
error | Number | current error |
BSD-3-Clause
FAQs
Execute a given callback at periodic interval, trying to minimize drift and jitter
We found that @ircam/ticker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.