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

repeat

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

repeat

create repeating task chains

  • 2.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

repeat

version language maintenance prettier

create repeating task chains

Contents

  • Features
  • Install
  • Chain
  • Contributing

Features

  • Chain any number of tasks and repeat them once or forever.
  • Optional synchronous and asynchronous API.

Install

From NPM:

> npm i repeat

Chain

Creating a new chain

The following chain will execute all tasks every second. A task is any callable function.

// ES6
import { Chain } from 'repeat'

// ES5
// let { Chain } = require('repeat')

let chain = new Chain()

chain
  .add(
    // task A
    () => console.log('how are you?'),
    // task B
    () => console.log('good')
    // you can add task C, D, E, F ...
  )
  .every(1000)

Examples

The following methods are available on the chain.

add
// add any number of tasks to the chain
chain.add(
  () => console.log('cat'),
  () => console.log('dog'),
  () => console.log('fish')
)
once
// execute the tasks once
chain.once()
every
// execute the tasks asynchronously every second
chain.every(1000)
forever
// execute the tasks as fast as possible
chain.forever()
cancel
// halt further execution of tasks
chain.cancel()

Contributing

Pull requests are encouraged. 😁

Keywords

FAQs

Package last updated on 28 Jun 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