Skip to content

Commit ae2432e

Browse files
committed
sync watcher
1 parent 47d151b commit ae2432e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/watcher.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ var uid = 0
1818
* - {Boolean} twoWay
1919
* - {Boolean} deep
2020
* - {Boolean} user
21+
* - {Boolean} sync
2122
* - {Function} [preProcess]
2223
* @constructor
2324
*/
@@ -34,6 +35,7 @@ function Watcher (vm, expOrFn, cb, options) {
3435
this.deep = !!options.deep
3536
this.user = !!options.user
3637
this.twoWay = !!options.twoWay
38+
this.sync = !!options.sync
3739
this.filters = options.filters
3840
this.preProcess = options.preProcess
3941
this.deps = []
@@ -160,7 +162,7 @@ p.afterGet = function () {
160162
*/
161163

162164
p.update = function () {
163-
if (!config.async) {
165+
if (this.sync || !config.async) {
164166
this.run()
165167
} else {
166168
batcher.push(this)

0 commit comments

Comments
 (0)