Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clock-timer.js

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clock-timer.js

Timing Events tied to clock.js

  • 1.1.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by400%
Maintainers
1
Weekly downloads
 
Created
Source

clock-timer.js Build Status

Greenkeeper badge

Timing Events tied to clock.js.

ClockTimer is a subclass of Clock, which adds methods to handle timeout and intervals relying on Clock's ticks.

Why?

Once built-in setTimeout and setInterval relies on CPU load, functions may delay an unexpected amount of time to execute. Having it tied to a clock's time is guaranteed to execute in a precise way.

See a quote from W3C Timers Specification:

This API does not guarantee that timers will fire exactly on schedule. Delays due to CPU load, other tasks, etc, are to be expected.

API

Clock

  • setInterval(handler, time, ...args) -> Delayed
  • setTimeout(handler, time, ...args) -> Delayed
  • clear() - clear all intervals and timeouts.

Delayed

  • active -> Boolean - Is it still active?
  • clear() -> void - Clear timeout/interval
  • reset() -> void - Reset elapsed time

License

MIT

Keywords

FAQs

Package last updated on 15 Jul 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc