Unlike thread sleep, this is achieved by wrapping a setTimeout inside Promise. It's best to use with async...await syntax.
import { delayUntil } from 'nodemod/dist/delay-until/index.js';
(async () => {
await delayUntil(3e3);
console.log('This message prints out after 3 seconds');
})();
delay
<?number> The delay, in milliseconds, the function should wait for before any code after where the delay function is called can be executed. This does not affect code execution in other thread, module, or even file.- returns: <Promise<
undefined
>> Promise which resolves with no return value.
MIT License © Rong Sen Ng