Socket
Book a DemoInstallSign in
Socket

@ambassify/clock

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

@ambassify/clock

A timer with drift correction

1.0.0
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

@ambassify/clock

A timer with drift correction

Installation

npm install --save @ambassify/clock

Usage

const Clock = require('@ambassify/clock');

const clock = new Clock(1000);

clock.on('tick', function() {
    console.log('1000ms elapsed');
});

clock.start();

API

Clock

new Clock(<interval>, [handler])

  • interval is the interval at which to fire the tick event in milliseconds.
  • handler optionally, a default handler for the tick event which will be attached for you.

.start()

Starts the interval, from this point onwards the tick event will fire every interval milliseconds.

.stop()

Stops the clock from ticking, no tick events will be fired until the clock is restarted using .start().

.on('tick', <handler>)

Attaches a new tick handler to the clock, a clock can have many tick handlers at the same time.

.off(`tick`, <handler>)

Detaches the handler function from the clock such that it will no longer receive tick events.

Contributing

If you have some issue or code you would like to add, feel free to open a Pull Request or Issue and we will look into it as soon as we can.

License

We are releasing this under a MIT License.

About us

If you would like to know more about us, be sure to have a look at our website, or our Twitter accounts Ambassify, Sitebase, JorgenEvens

Keywords

timer

FAQs

Package last updated on 28 Feb 2018

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.