p-immediate

v4.0.0
Returns a promise resolved in the next event loop - think `setImmediate()`
promise resolve immediate setimmediate event loop next tick delay and 6 more...

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…
npm i p-immediate

Metadata

  • MIT
  • >=12
  • Sindre Sorhus
  • released 4/9/2021

Downloads

Maintainers