Avoid using next-tick-2
or next-tick
. setTimeout(...)
is a better alternative, and it's available everywhere.
Environment agnostic nextTick polyfill
A commonjs module that provides nextTick functionality in node and the browser.
- When run in Node.js
process.nextTick
is used - In modern browsers microtask resolution is guaranteed by
MutationObserver
- In other engines
setImmediate
orsetTimeout(fn, 0)
is used as fallback. - If none of the above is supported module resolves to
undefined
The original next-tick
module includes the node process
module, which causes browserify
to shim the module. It results in a larger bundle size, with unused code.
The original maintainer is not interested in fixing the problem. As a result the browserified code
that relies on next-tick-2
is significantly (3.4X) smaller than that generated by next-tick
:
-rw-r--r-- 1 mike staff 8022 May 2 11:18 bundle-next-tick.js
-rw-r--r-- 1 mike staff 2334 May 2 11:18 bundle-next-tick-2.js