Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d44c34e

Browse files
docs(whenever): add watch source array example
1 parent ad90d1e commit d44c34e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

packages/shared/whenever/index.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,27 @@ whenever(height, (current, lastHeight) => {
4545
})
4646
```
4747

48+
### Sources Array
49+
50+
Same as `watch`, multiple sources can be passed to check if any of them are true.
51+
52+
```ts
53+
import { whenever } from '@vueuse/core'
54+
// ---cut---
55+
// this
56+
whenever([result, error], () => {
57+
loading.value = false
58+
})
59+
60+
// is equivalent to:
61+
whenever(result, () => {
62+
loading.value = false
63+
})
64+
whenever(error, () => {
65+
loading.value = false
66+
})
67+
```
68+
4869
### Computed
4970

5071
Same as `watch`, you can pass a getter function to calculate on each change.

0 commit comments

Comments
 (0)