feat(runtime-core): watchSyncEffect

This commit is contained in:
Evan You
2021-07-20 16:49:54 -04:00
parent 33c2fbfdc8
commit d87d059ac1
3 changed files with 64 additions and 3 deletions

View File

@@ -96,6 +96,19 @@ export function watchPostEffect(
)
}
export function watchSyncEffect(
effect: WatchEffect,
options?: DebuggerOptions
) {
return doWatch(
effect,
null,
(__DEV__
? Object.assign(options || {}, { flush: 'sync' })
: { flush: 'sync' }) as WatchOptionsBase
)
}
// initial value for watchers to trigger on undefined initial values
const INITIAL_WATCHER_VALUE = {}