Skip to content

Commit

Permalink
Merge pull request vuejs#2200 from Jinjiang/feature-next-tick
Browse files Browse the repository at this point in the history
improve nextTick by setImmediate
  • Loading branch information
yyx990803 committed Jan 22, 2016
2 parents 69d4d45 + 38accc1 commit e4accfc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/util/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const nextTick = (function () {
copies[i]()
}
}

/* istanbul ignore if */
if (typeof MutationObserver !== 'undefined') {
var counter = 1
Expand All @@ -82,6 +83,8 @@ export const nextTick = (function () {
counter = (counter + 1) % 2
textNode.data = counter
}
} else if (typeof setImmediate === 'function') {
timerFunc = setImmediate
} else {
timerFunc = setTimeout
}
Expand Down

0 comments on commit e4accfc

Please sign in to comment.