p-immediate
TypeScript icon, indicating that this package has built-in type declarations

4.0.0 • Public • Published

p-immediate

Returns a promise resolved in the next event loop - think setImmediate()

Promises are by default resolved in a microtask (current event loop).

Install

$ npm install p-immediate

Usage

import pImmediate from 'p-immediate';

await pImmediate();

// Executed in the next event loop
console.log('🦄');

Related

  • delay - Delay a promise a specified amount of time
  • p-min-delay - Delay a promise a minimum amount of time
  • p-timeout - Timeout a promise after a specified amount of time
  • More…

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 4.0.0
    621
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 4.0.0
    621
  • 3.2.0
    1,129
  • 3.1.0
    276
  • 3.0.0
    0
  • 2.1.0
    65

Package Sidebar

Install

npm i p-immediate

Weekly Downloads

2,091

Version

4.0.0

License

MIT

Unpacked Size

3.35 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus