progressive-timeout
v1.0.5
Published
Simple implementation of progressive timeout
Downloads
3
Readme
Progressive timeout
Simple implementation of progressive timeout in JavaScript.
Install
via NPM
npm install progressive-timeout --save
Usage
Define new instance of ProgressiveTimeout with providing calback function as first parametr and options object as second parametr. Options object should contain MIN, MAX and STEP properties. When the next tick reaches the MAX value, it becomes MAX.
import ProgressiveTimeout from 'progressive-timeout';
const OPTIONS = {
min: 500,
max: 20000,
step: 2000,
};
progressiveTimeout = new ProgressiveTimeout(callback, OPTIONS);
start()
progressiveTimeout.start(); // now timeout tick increase every 'step' ms
stop()
progressiveTimeout.stop(); // stop and clear timeout
License
This project is licensed under the MIT license, Copyright (c) 2018 Yuriy. For more information see LICENSE
.