Skip to content

setImmediate polyfill for when you value code size over speed of async execution

Notifications You must be signed in to change notification settings

davidmarkclements/setImmediate-min

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

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 --save
require('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 setTimeout was "good enough" .. because "clamping"
    • But clamping was/is broken, so setTimeout is a
      significantly slower than setImmediate
  • Because WebKit team haven't implemented, Firefox have followed their lead
  • Thus, we only have setImmediate in 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.

About

setImmediate polyfill for when you value code size over speed of async execution

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published