Know when the microtask queue is empty
https://github.com/aleclarson/flush-microtasks.git
Return a thenable that resolves when the microtask queue is empty.
Taken from enqueueTask.js in React.
import { flushMicroTasks } from 'flush-microtasks'
await flushMicroTasks()