1.0.1 • Published 11 years ago
setimmediate-min v1.0.1
setImmediate-min
setImmediate polyfill for when you value code size over speed of async execution
For use with old versions of Node and Browsers not
supporting setImmediate. Package for browsers using
browserify.
npm install setimmediate-min --saverequire('setimmediate-min')() About
setImmediate is a "controversial" API.
Reasons for this are not entirely clear to me, but from what I gather
- WebKit have been reluctant to implement (for like.. 3-4 years now)
- Reason seems to be they felt
setTimeoutwas "good enough" .. because "clamping" - But clamping was/is broken, so
setTimeoutis a
significantly slower thansetImmediate
- Reason seems to be they felt
- Because WebKit team haven't implemented, Firefox have followed their lead
- Thus, we only have
setImmediatein IE and Node at the moment.
There are some excellent polyfills that piggy back on whatever native asynchronous API is fastest for a given browser, if you want the fastest possible async operation, check out https://www.npmjs.org/package/setimmediate
If, however, you want something that's a small amount of code, and it doesn't matter if the op is a couple of hundred milliseconds slower use this.