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

set-interval

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

set-interval

start and clear interval without setting a variable

  • 2.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
538
increased by21.17%
Maintainers
1
Weekly downloads
 
Created
Source

SetIntervalJS Twitter URL

MIT Licence Build Status npm version Known Vulnerabilities

SetIntervalJS is a constructor which hide inside reference to setInterval() for cleaner usage. It helps to make your code cleaner and there is no need to have more variables for clearInterval() and you can clear interval anywhere you want👌.

Getting SetIntervalJS

npm

npm install --save set-interval

yarn

yarn add set-interval --save

Examples

SetInterval.start(function, milliseconds, key_string)

Basic example

import SetInterval from 'set-interval'

SetInterval.start(callback, 1000, 'test')
SetInterval.clear('test')

Multiple instances

// -> ./start.js
import SetInterval from 'set-interval'

SetInterval.start(callback, 1000, 'test')
SetInterval.start(callback_2, 1000, 'test_2')
SetInterval.start(callback_3, 1000, 'test_3')


// -> ./clear.js
import SetInterval from 'set-interval'

SetInterval.clear('test')
SetInterval.clear('test_2')
SetInterval.clear('test_3')

API

SetInterval.start(callback, milliseconds, key_string)

callback

Type: function
Function that gets called in each milliseconds interval

milliseconds

Type: number
Interval time in which callback function gets called

key_string

Type: string
Key name for which interval will be referenced

SetInterval.clear(key_string)

key_string

Type: string
Key name which was passed to .start method

Contributing

Any contributions you make are greatly appreciated.

Please read the Contributions Guidelines before submitting a PR.

License

MIT © Vasyl Stokolosa

Keywords

FAQs

Package last updated on 21 May 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