Skip to main content

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