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

@avinlab/repeat

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@avinlab/repeat

Make repeat actions easily

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by33.33%
Maintainers
1
Weekly downloads
 
Created
Source

@avinlab/repeat build

Make repeat actions easily.

Install

# Yarn
yarn add @avinlab/repeat

# NPM
npm install --save @avinlab/repeat

Usage

import repeat from '@avinlab/repeat';

const repeatAction = repeat({
    action: counter => {
        console.log(counter);
    },
    delay: 500,
    firstTimeDelay: 1000,
    skipFirst: true,
});

// Start interval actions
repeatAction.start();

// Stop interval actions
repeatAction.stop();

API

Options

  • action (Function) - Interval function. Params: counter - call action index number.
  • delay (Number) - Sleep time in ms between actions.
  • firstTimeDelay (Number) - First time sleep period in ms.
  • skipFirst (Boolean) - Skip first time action call.
  • times (Number) - Repeat N times.

Methods

  • start() - Start repeat actions.
  • stop() - Stop repeat actions.
  • pause() - Pause repeat actions (without reset counter and don't touch firstTimeRun flag).
  • resume() - Resume repeating after pause.
  • updateDelay(newDelay) - Update option delay value without restart (update with next tick).

License

MIT © avin

Keywords

FAQs

Package last updated on 17 Jan 2019

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