1.0.0 • Published 3 years ago

nn-sleep v1.0.0

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

nn-sleep

Functions for sleeping.

Usage

import { sleep } from 'nn-sleep';
import { sleepUntil } from 'nn-sleep';

// Wait for 1 second (1000 milliseconds).
await sleep( 1000 );

// Wait until condition is true. Function will be called to test condition at an intervals specified
// by frequency but no longer than the max_duration.
await sleepUntil( function ()
{
	return condition;
}, frequency, max_duration );