From e12c23dfe8cec8d9f1d4186b17790fcf310a5c71 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Tue, 10 Aug 2021 04:34:08 +0800 Subject: [PATCH] feat: new `watchSyncEffect` api --- src/apis/watch.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/apis/watch.ts b/src/apis/watch.ts index 3e130ee7..9c165f58 100644 --- a/src/apis/watch.ts +++ b/src/apis/watch.ts @@ -400,6 +400,10 @@ export function watchPostEffect(effect: WatchEffect) { return watchEffect(effect, { flush: 'post' }) } +export function watchSyncEffect(effect: WatchEffect) { + return watchEffect(effect, { flush: 'sync' }) +} + // overload #1: array of multiple sources + cb // Readonly constraint helps the callback to correctly infer value types based // on position in the source array. Otherwise the values will get a union type