Simple
setImmediate
ponyfill
Note: This shim is quite inefficient.
npm install set-immediate-shim
import setImmediateShim from 'set-immediate-shim';
setImmediateShim(() => {
console.log('2');
});
console.log('1');
//=> 1
//=> 2
- p-immediate - Returns a promise resolved in the next event loop - think
setImmediate()