Skip to content

Simple implementation of progressive timeout in JavaScript.

License

Notifications You must be signed in to change notification settings

froziq/progressive-timeout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Progressive timeout

Simple implementation of progressive timeout in JavaScript.

Build Status npm npm

DEMO

progressive-timeout

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

Authors

  • Yuriy Markov - Initial work - froziq

License

This project is licensed under the MIT license, Copyright (c) 2018 Yuriy. For more information see LICENSE.

About

Simple implementation of progressive timeout in JavaScript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published