Skip to content

sindresorhus/set-immediate-shim

Repository files navigation

set-immediate-shim

Simple setImmediate ponyfill

Note: This shim is quite inefficient.

Install

npm install set-immediate-shim

Usage

import setImmediateShim from 'set-immediate-shim';

setImmediateShim(() => {
	console.log('2');
});

console.log('1');

//=> 1
//=> 2

Related

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