Functions for sleeping.
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 );