Socket
Socket
Sign inDemoInstall

nodejs-timer

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodejs-timer

Timer for Node.js


Version published
Weekly downloads
103
decreased by-43.72%
Maintainers
1
Weekly downloads
 
Created
Source

nodejs-timer Build Status

Timer for Node.js

Installation

npm i nodejs-timer

require

const { Timer } = require('nodejs-timer');

npm package
Github page

Usage

Construction

new Timer(timeoutEvent) -> Timer
// Create a timer
const timer = new Timer((param) => {
  console.log(param);
});
timeoutEvent<T extends any[]>

Required
Type: (...params: T) => void;


start

timer.start(ms, ...params) -> boolean

Returns false if the timer is already running. otherwise, return true.

// start the timer
timer.start(1000, 'Hello nodejs-timer');
ms

Required
Type: number
Desc: milliseconds to trigger timeoutEvent

...params

Optional
Type: T extends any[]
Desc: Parameters pass to timeoutEvent


clear(stop)

timer.clear() -> boolean

Stop the timer. Returns true if the timer is running. otherwise, return false.

// clear (stop) the timer
timer.clear();

isRunning

timer.isRunning() -> boolean

Returns true is the timer is running. otherwise, return false.

// Get the time isRunning
timer.isRunning();

trigger

timer.trigger(...params) -> void
// trigger the timeoutEvent
timer.trigger('Hello nodejs-timer from trigger');
...params

Optional
Type: T extends any[]
Desc: Parameters pass to timeoutEvent

Keywords

FAQs

Package last updated on 29 Apr 2021

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