@@ -25,9 +25,8 @@ function resetSchedulerState () {
25
25
// if we got to the end of the queue, we can just empty the queue
26
26
if ( index === queue . length ) {
27
27
queue . length = 0
28
- }
29
28
// else, we only remove watchers we ran
30
- else {
29
+ } else {
31
30
queue . splice ( 0 , index )
32
31
}
33
32
has = { }
@@ -42,11 +41,11 @@ function resetSchedulerState () {
42
41
*/
43
42
function flushSchedulerQueue ( maxUpdateCount ?: number ) {
44
43
if ( flushing ) {
45
- throw new Error ( " Cannot flush while already flushing." )
44
+ throw new Error ( ' Cannot flush while already flushing.' )
46
45
}
47
46
48
47
if (insideRun) {
49
- throw new Error ( " Cannot flush while running a watcher." )
48
+ throw new Error ( ' Cannot flush while running a watcher.' )
50
49
}
51
50
52
51
maxUpdateCount = maxUpdateCount || config._maxUpdateCount
@@ -97,7 +96,7 @@ function flushSchedulerQueue (maxUpdateCount?: number) {
97
96
if ( afterFlushCallbacks . length ) {
98
97
// call one afterFlush callback, which may queue more watchers
99
98
// TODO: Optimize to not modify array at every run.
100
- let func = afterFlushCallbacks . shift ( )
99
+ const func = afterFlushCallbacks . shift ( )
101
100
try {
102
101
func ( )
103
102
} catch ( e ) {
@@ -113,8 +112,7 @@ function flushSchedulerQueue (maxUpdateCount?: number) {
113
112
}
114
113
}
115
114
}
116
- }
117
- finally {
115
+ } finally {
118
116
// a hook can throw as well
119
117
try {
120
118
// call updated hooks
@@ -132,8 +130,7 @@ function flushSchedulerQueue (maxUpdateCount?: number) {
132
130
if ( devtools && config . devtools ) {
133
131
devtools . emit ( 'flush' )
134
132
}
135
- }
136
- finally {
133
+ } finally {
137
134
resetSchedulerState ( )
138
135
}
139
136
}
@@ -204,4 +201,4 @@ export function wrapWatcherGetter (f: Function): Function {
204
201
insideRun = previousInsideRun
205
202
}
206
203
}
207
- }
204
+ }
0 commit comments