JSPM

setimmediate-min

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q19842F
  • License MIT

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

Package Exports

  • setimmediate-min

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (setimmediate-min) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.