Skip to content

Commit

Permalink
chore: unify the terms 'microtask' and '(macro) task' (#7641)
Browse files Browse the repository at this point in the history
  • Loading branch information
yaodingyd authored and yyx990803 committed Mar 8, 2018
1 parent b2092db commit acd92cf
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/core/util/next-tick.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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()
Expand All @@ -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 () {
Expand Down

0 comments on commit acd92cf

Please sign in to comment.