Skip to content

Commit d317610

Browse files
feat(watchAtMost): add pause and resume to return value (#4897)
1 parent b8102b5 commit d317610

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/shared/watchAtMost/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ export interface WatchAtMostOptions<Immediate> extends WatchWithFilterOptions<Im
1010

1111
export interface WatchAtMostReturn {
1212
stop: WatchStopHandle
13+
pause: () => void
14+
resume: () => void
1315
count: ShallowRef<number>
1416
}
1517

@@ -31,7 +33,7 @@ export function watchAtMost<Immediate extends Readonly<boolean> = false>(
3133

3234
const current = shallowRef(0)
3335

34-
const stop = watchWithFilter(
36+
const { stop, resume, pause } = watchWithFilter(
3537
source,
3638
(...args) => {
3739
current.value += 1
@@ -43,5 +45,5 @@ export function watchAtMost<Immediate extends Readonly<boolean> = false>(
4345
watchOptions,
4446
)
4547

46-
return { count: current, stop }
48+
return { count: current, stop, resume, pause }
4749
}

0 commit comments

Comments
 (0)