yieldToEventLoop
Gives the event loop one turn (one macrotask), by posting a MessageChannel message to itself.
Unlike a zero-length timer or requestAnimationFrame, it is not throttled in a hidden window, and unlike setImmediate it works outside Node.
Import:
import { yieldToEventLoop } from '@mnaoumov/typescript-lib/event-loop-turn';Signature:
function yieldToEventLoop(): Promise<void>Returns: Promise<void> — A promise that resolves on the next event loop turn.
Links to this page: