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

delay-repeater

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

delay-repeater

Run a function repeatly with a delay

  • 1.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-20%
Maintainers
1
Weekly downloads
 
Created
Source

Run your code repeatly with a delay

Install

npm install delay-repeater

Usage

//es6 module
import repeat from 'delay-repeater';
//or CommonJS require style
const repeat = require('delay-repeater').default;

const fn = () => {
  console.log('ipsum');
}
const times = 3;
const interval = 3000; // 3 seconds
repeat(fn, times, interval);

//or with an error first callback
const done = (e) => {
  if (e) {
    return console.log(e);
  }
  console.log('3 times execution finished');
}
repeat(fn, times, interval, done);

Note If the fn returns a Promise, the delay will be after the Promise resolved, this is easy to run some asynchrous codes(e.g. http request or IO) repeatly.

License

MIT

FAQs

Package last updated on 22 Sep 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

  • 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