New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

expiry-timer

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

expiry-timer

A handy module for creating an expiry timer

  • 1.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

#Expiry Timer NPM

Code Climate Build Status dependencies Status

Sometimes, it's useful in code to know if a certain amount of time has elapsed.

This module (dependent only on the babel-runtime) provides a nice, neat interface for that

Installation

npm i expiry-timer --save

Usage

import timer from '../src/timer';

const e = timer(5000); // 5 seconds;

/*
 * Some time later 
 */
if (e.done()) {
    /* Do a thing */
    e.reset(); // Clock starts ticking immediately
}

API

To create a timer that counts down for time milliseconds:

const counter = timer(time);

Call done() on the timer to see if it has expired:

if (counter.done() {
    /* do something */
}

Call reset() to reset the timer back to its original length.

Call reset(newLength) to reset the timer to a new length.

License

Provided under the MIT License.

FAQs

Package last updated on 24 Jan 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