Socket
Book a DemoInstallSign in
Socket

timercore

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timercore

Precision timer library

1.0.2
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

timercore :hourglass_flowing_sand:

npm downloads tests maintained

Robust, accurate, and precise timer library for Node.js

Install

npm

npm install --save timercore

yarn

yarn add timercore

Example

const Timer = require ('timercore')

// The timer expects a non-negative integer argument
const seconds = 10
const timer = new Timer (seconds)

// A timer initialized with zero will not emit any events and starting or
// stopping the timer will have no effect

timer.on ('tick', (secondsRemaining) => {
	// The tick event is emitted every second

	// The total number of tick events is equal to the number of seconds used to
	// initialize the timer
})

timer.on ('beep', () => {
	// The beep event is emitted once, after the final tick event
})

// Start the timer
timer.start ()

// Start it again if you like; the start method is idempotent
timer.start ()

// Stop the timer
timer.stop ()

// Stop it again if you like; the stop method is also idempotent
timer.stop ()

// Resume the timer if it was previously stopped and has not yet finished
timer.start ()

// Starting or stopping a timer that has finished will have no effect

// When you are done with a timer and need another, just create a new one
const anotherTimer = new Timer (60)

Keywords

timercore

FAQs

Package last updated on 26 Dec 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

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.