Skip to main content
Deno 2 is finally here ๐ŸŽ‰๏ธ
Learn more

delay

The standard Deno module for delaying a specified amount of time.

๐Ÿ”ง How to use

import { delay } from 'https://deno.land/x/delay@v0.2.0/mod.ts';

๐Ÿ’ก Usage

๐ŸŽ€ delay

import { delay } from 'https://deno.land/x/delay@v0.2.0/mod.ts';

(async () => {
  console.log('Executed 100 milliseconds later')

  await delay(100);

  console.log('Hello World!')
})();

๐ŸŽ€ delay.reject

import { delay } from 'https://deno.land/x/delay@v0.2.0/mod.ts';

(async () => {
  try {
    await delay.reject(100, { value: new Error('Rejected') });

    console.log('This is never executed');
  } catch (error) {
    // 100 milliseconds later
    console.log(error);
    //=> [Error: Rejected]
  }
})();

๐Ÿ“œ Changelog

Details changes for each release are documented in the CHANGELOG.md.

โ— Issues

If you think any of the delay can be improved, please do open a PR with any updates and submit any issues. Also, I will continue to improve this, so you might want to watch/star this repository to revisit.

๐Ÿ’ช Contribution

Weโ€™d love to have your helping hand on contributions to delay by forking and sending a pull request!

Your contributions are heartily โ™ก welcome, recognized and appreciated. (โœฟโ— โ€ฟโ— )

How to contribute:

  • Open pull request with improvements
  • Discuss ideas in issues
  • Spread the word
  • Reach out with any feedback

โš–๏ธ License

The MIT License License: MIT