@24hr/wait-until-idle
v1.1.0
Published
A class that creates a way to postpone calling a function until no more calls are made for a specified amount of time.
Downloads
10
Maintainers
Keywords
Readme
Wait Until Idle
A class that creates a way to postpone calling a function until no more calls are made for a specified amount of time.
As well as a class to easier manage multiple instances of the waiter objects.
Examples
WaitUntilIdle
import { WaitUntilIdle } from 'wait-until-idle';
const waitUntilIdle = new WaitUntilIdle();
waitUntilIdle.createStartOrReset('insert-id-here', () => {
console.log('This will only be called once after 1 second if no one calls reset again.');
}, 1000);
waitUntilIdle.createStartOrReset('a-self-destructing-waiter-object', () => {
console.log('This will only be called once after 1 second if no one calls reset again.');
}, 1000, true);
waitUntilIdle.startOrReset('some-id-for-the-wait');
WaiterObject
import { WaiterObject } from 'wait-until-idle';
const waiterObject = new WaiterObject(() => {
console.log('This will only be called once after 1 second if no one calls reset again.');
}, 1000);
waiterObject.startOrReset();