Преглед изворни кода

update comments to nextTick defer function

Evan You пре 11 година
родитељ
комит
513b2ae1fe
1 измењених фајлова са 9 додато и 1 уклоњено
  1. 9 1
      src/util/env.js

+ 9 - 1
src/util/env.js

@@ -18,7 +18,15 @@ var inBrowser = exports.inBrowser =
   toString.call(window) !== '[object Object]'
 
 /**
- * Defer a task to the start of the next event loop
+ * Defer a task to execute it asynchronously. Ideally this
+ * should be executed as a microtask, so we leverage
+ * MutationObserver if it's available.
+ * 
+ * If the user has included a setImmediate polyfill, we can
+ * also use that. In Node we actually prefer setImmediate to
+ * process.nextTick so we don't block the I/O.
+ * 
+ * Finally, fallback to setTimeout(0) if nothing else works.
  *
  * @param {Function} cb
  * @param {Object} ctx