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…

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i p-immediate

    Weekly Downloads

    1,825

    Version

    4.0.0

    License

    MIT

    Unpacked Size

    3.35 kB

    Total Files

    5

    Last publish

    Collaborators

    • sindresorhus