Socket
Socket
Sign inDemoInstall

@avinlab/repeat

Package Overview
Dependencies
2
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @avinlab/repeat

Make repeat actions easily


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
284 kB
Created
Weekly downloads
 

Readme

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

Last updated on 17 Jan 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc