Skip to content

Latest commit

 

History

History

delay-until

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

delay-until

A typical delay function but Promise based


MIT License

Unlike thread sleep, this is achieved by wrapping a setTimeout inside Promise. It's best to use with async...await syntax.

Table of contents

Usage

import { delayUntil } from 'nodemod/dist/delay-until/index.js';

(async () => {
  await delayUntil(3e3);

  console.log('This message prints out after 3 seconds');
})();

API Reference

delayUntil([delay])

  • 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.

License

MIT License © Rong Sen Ng