start and clear interval without setting a variable
npm install set-intervalSetIntervalJS 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👌.
npm install --save set-interval#### yarnyarn add set-interval --save
javascript
SetInterval.start(function, milliseconds, key_string)
`$3
`javascript
import SetInterval from 'set-interval'SetInterval.start(callback, 1000, 'test')
SetInterval.clear('test')
`$3
`javascript
// -> ./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 ##
$3
#### 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
$3
#### key_string ####
Type: string` Any contributions you make are greatly appreciated.
Please read the Contributions Guidelines before submitting a PR.
MIT © Vasyl Stokolosa