Skip to content

Commit b949953

Browse files
committed
Code style.
1 parent 92fd14a commit b949953

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

src/core/observer/scheduler.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ function resetSchedulerState () {
2525
// if we got to the end of the queue, we can just empty the queue
2626
if (index === queue.length) {
2727
queue.length = 0
28-
}
2928
// else, we only remove watchers we ran
30-
else {
29+
} else {
3130
queue.splice(0, index)
3231
}
3332
has = {}
@@ -42,11 +41,11 @@ function resetSchedulerState () {
4241
*/
4342
function flushSchedulerQueue (maxUpdateCount?: number) {
4443
if (flushing) {
45-
throw new Error("Cannot flush while already flushing.")
44+
throw new Error('Cannot flush while already flushing.')
4645
}
4746

4847
if (insideRun) {
49-
throw new Error("Cannot flush while running a watcher.")
48+
throw new Error('Cannot flush while running a watcher.')
5049
}
5150

5251
maxUpdateCount = maxUpdateCount || config._maxUpdateCount
@@ -97,7 +96,7 @@ function flushSchedulerQueue (maxUpdateCount?: number) {
9796
if (afterFlushCallbacks.length) {
9897
// call one afterFlush callback, which may queue more watchers
9998
// TODO: Optimize to not modify array at every run.
100-
let func = afterFlushCallbacks.shift()
99+
const func = afterFlushCallbacks.shift()
101100
try {
102101
func()
103102
} catch (e) {
@@ -113,8 +112,7 @@ function flushSchedulerQueue (maxUpdateCount?: number) {
113112
}
114113
}
115114
}
116-
}
117-
finally {
115+
} finally {
118116
// a hook can throw as well
119117
try {
120118
// call updated hooks
@@ -132,8 +130,7 @@ function flushSchedulerQueue (maxUpdateCount?: number) {
132130
if (devtools && config.devtools) {
133131
devtools.emit('flush')
134132
}
135-
}
136-
finally {
133+
} finally {
137134
resetSchedulerState()
138135
}
139136
}
@@ -204,4 +201,4 @@ export function wrapWatcherGetter (f: Function): Function {
204201
insideRun = previousInsideRun
205202
}
206203
}
207-
}
204+
}

src/core/observer/watcher.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default class Watcher {
7979
)
8080
}
8181
}
82-
this.getter = wrapWatcherGetter(this.getter);
82+
this.getter = wrapWatcherGetter(this.getter)
8383
this.value = this.lazy
8484
? undefined
8585
: this.get()
@@ -99,8 +99,7 @@ export default class Watcher {
9999
}
100100
this.cleanupDeps()
101101
return value
102-
}
103-
finally {
102+
} finally {
104103
popTarget()
105104
}
106105
}

0 commit comments

Comments
 (0)