/p-immediate

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

Primary LanguageJavaScriptMIT LicenseMIT

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…