|
1 | 1 | /* this implementation is original ported from https://github.com/logaretm/vue-use-web by Abdelrahman Awad */ |
2 | 2 |
|
3 | | -import type { ComputedRef, MaybeRefOrGetter } from 'vue' |
| 3 | +import type { ComputedRef, MaybeRefOrGetter, ShallowRef } from 'vue' |
4 | 4 | import type { ConfigurableNavigator } from '../_configurable' |
5 | 5 | import { useTimeoutFn } from '@vueuse/shared' |
6 | | -import { computed, shallowRef, toValue } from 'vue' |
| 6 | +import { computed, readonly, shallowRef, toValue } from 'vue' |
7 | 7 | import { defaultNavigator } from '../_configurable' |
8 | 8 | import { useEventListener } from '../useEventListener' |
9 | 9 | import { usePermission } from '../usePermission' |
@@ -39,8 +39,8 @@ export interface UseClipboardOptions<Source> extends ConfigurableNavigator { |
39 | 39 |
|
40 | 40 | export interface UseClipboardReturn<Optional> { |
41 | 41 | isSupported: ComputedRef<boolean> |
42 | | - text: ComputedRef<string> |
43 | | - copied: ComputedRef<boolean> |
| 42 | + text: Readonly<ShallowRef<string>> |
| 43 | + copied: Readonly<ShallowRef<boolean>> |
44 | 44 | copy: Optional extends true ? (text?: string) => Promise<void> : (text: string) => Promise<void> |
45 | 45 | } |
46 | 46 |
|
@@ -130,8 +130,8 @@ export function useClipboard(options: UseClipboardOptions<MaybeRefOrGetter<strin |
130 | 130 |
|
131 | 131 | return { |
132 | 132 | isSupported, |
133 | | - text: text as ComputedRef<string>, |
134 | | - copied: copied as ComputedRef<boolean>, |
| 133 | + text: readonly(text), |
| 134 | + copied: readonly(copied), |
135 | 135 | copy, |
136 | 136 | } |
137 | 137 | } |
0 commit comments