Skip to content
Permalink
Browse files

chore: unify the terms 'microtask' and '(macro) task' (#7641)

  • Loading branch information
yaodingyd authored and yyx990803 committed Mar 8, 2018
1 parent b2092db commit acd92cf981d384d4006c81b9001a6d35957630dc
Showing with 8 additions and 8 deletions.
  1. +8 −8 src/core/util/next-tick.js
@@ -17,19 +17,19 @@ function flushCallbacks () {
}
}

// Here we have async deferring wrappers using both micro and macro tasks.
// In < 2.4 we used micro tasks everywhere, but there are some scenarios where
// micro tasks have too high a priority and fires in between supposedly
// Here we have async deferring wrappers using both microtasks and (macro) tasks.
// In < 2.4 we used microtasks everywhere, but there are some scenarios where
// microtasks have too high a priority and fire in between supposedly
// sequential events (e.g. #4521, #6690) or even between bubbling of the same
// event (#6566). However, using macro tasks everywhere also has subtle problems
// event (#6566). However, using (macro) tasks everywhere also has subtle problems
// when state is changed right before repaint (e.g. #6813, out-in transitions).
// Here we use micro task by default, but expose a way to force macro task when
// Here we use microtask by default, but expose a way to force (macro) task when
// needed (e.g. in event handlers attached by v-on).
let microTimerFunc
let macroTimerFunc
let useMacroTask = false

// Determine (macro) Task defer implementation.
// Determine (macro) task defer implementation.
// Technically setImmediate should be the ideal choice, but it's only available
// in IE. The only polyfill that consistently queues the callback after all DOM
// events triggered in the same loop is by using MessageChannel.
@@ -56,7 +56,7 @@ if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
}
}

// Determine MicroTask defer implementation.
// Determine microtask defer implementation.
/* istanbul ignore next, $flow-disable-line */
if (typeof Promise !== 'undefined' && isNative(Promise)) {
const p = Promise.resolve()
@@ -76,7 +76,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {

/**
* Wrap a function so that if any code inside triggers state change,
* the changes are queued using a Task instead of a MicroTask.
* the changes are queued using a (macro) task instead of a microtask.
*/
export function withMacroTask (fn: Function): Function {
return fn._withTask || (fn._withTask = function () {

0 comments on commit acd92cf

Please sign in to comment.
You can’t perform that action at this time.