microJ / nextTick

process.nextTick in Browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nextTick

process.nextTick in Browser.

polyfill order

process.nextTick is MicroTask. so we first choose MicroTask API Promise and MutationObserver rather than MacroTask API.

  1. Promise

    Morden browser

  2. MutationObserver

    IE 11

  3. MessageChannel

    IE 10

  4. onreadystatechange

    IE 6~10

why not use these

postMessage:

support IE 10~11.

don't work well in web worker. api doc

setImmediate:

support IE 10~11.

but there is a bug: broken on IE 10.

setTimeout:

support IE 6+.

  1. browser maybe limit min timeout 1ms.
  2. Timers can be nested; after five such nested timers, however, the interval is forced to be at least four milliseconds.

About

process.nextTick in Browser


Languages

Language:JavaScript 71.4%Language:HTML 28.6%