1.1.0 • Published 2 years ago

@24hr/wait-until-idle v1.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

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();
1.1.0

2 years ago

1.0.1

3 years ago

1.0.0

3 years ago