/*
Chain this to a function when you need to wait for the next tick of the event loop to run.
Why request animation frame instead of setTimeout?

setTimeout:

    Calls a function or evaluates an expression after a specified number of milliseconds.
    Doesn't mean that the function will be called after the exactly specified interval.
    Less accurate, it can cause a browser to miss the frame.

requestAnimationFrame:

    Works similarly to setTimeout.
    More accurate. it's called right before the next repaint in the browser occurs.
    Less resources.

nextTick
1. Promise constructor internally calls requestAnimationFrame; the browser internally schedules it as a request for animation.
2. When browser is ready to animate requested frame, it invokes the callback provided to requestAnimationFrame, in this case it's the resolve() callback from the promise.
    In addition resolve will be passed with a timestamp from requestAnimationFrame i.e. the promise will be resolved with a timestamp value.

*/
const nextTick = () => new Promise(requestAnimationFrame);
export { nextTick };
//# sourceMappingURL=next-tick.js.map