File tree Expand file tree Collapse file tree 1 file changed +12
-19
lines changed Expand file tree Collapse file tree 1 file changed +12
-19
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ import {
12
12
// triggered, the DOM would have already been in updated
13
13
// state.
14
14
15
- var queueIndex
16
15
var queue = [ ]
17
16
var userQueue = [ ]
18
17
var has = { }
@@ -57,8 +56,8 @@ function flushBatcherQueue () {
57
56
function runBatcherQueue ( queue ) {
58
57
// do not cache length because more watchers might be pushed
59
58
// as we run existing watchers
60
- for ( queueIndex = 0 ; queueIndex < queue . length ; queueIndex ++ ) {
61
- var watcher = queue [ queueIndex ]
59
+ for ( let i = 0 ; i < queue . length ; i ++ ) {
60
+ var watcher = queue [ i ]
62
61
var id = watcher . id
63
62
has [ id ] = null
64
63
watcher . run ( )
@@ -91,22 +90,16 @@ function runBatcherQueue (queue) {
91
90
export function pushWatcher ( watcher ) {
92
91
var id = watcher . id
93
92
if ( has [ id ] == null ) {
94
- if ( internalQueueDepleted && ! watcher . user ) {
95
- // an internal watcher triggered by a user watcher...
96
- // let's run it immediately after current user watcher is done.
97
- userQueue . splice ( queueIndex + 1 , 0 , watcher )
98
- } else {
99
- // push watcher into appropriate queue
100
- var q = watcher . user
101
- ? userQueue
102
- : queue
103
- has [ id ] = q . length
104
- q . push ( watcher )
105
- // queue the flush
106
- if ( ! waiting ) {
107
- waiting = true
108
- nextTick ( flushBatcherQueue )
109
- }
93
+ // push watcher into appropriate queue
94
+ var q = internalQueueDepleted || watcher . user
95
+ ? userQueue
96
+ : queue
97
+ has [ id ] = true
98
+ q . push ( watcher )
99
+ // queue the flush
100
+ if ( ! waiting ) {
101
+ waiting = true
102
+ nextTick ( flushBatcherQueue )
110
103
}
111
104
}
112
105
}
You can’t perform that action at this time.
0 commit comments