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

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

  • 1.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
decreased by-94.26%
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

Required
Type: (param: any) => void;


start

timer.start(ms, param) -> 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

param

Optional
Type: any
Desc: Parameter 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(param) -> void
// trigger the timeoutEvent
timer.trigger('Hello nodejs-timer from trigger');
param

Optional
Type: any
Desc: Parameter pass to timeoutEvent

Keywords

FAQs

Package last updated on 17 Dec 2020

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