Skip to content

createSharedComposable

Category
Export Size
232 B
Last Changed
4 days ago
Related

Make a composable function usable with multiple Vue instances.

Usage

ts
import { 
createSharedComposable
,
useMouse
} from '@vueuse/core'
const
useSharedMouse
=
createSharedComposable
(
useMouse
)
// CompA.vue const {
x
,
y
} =
useSharedMouse
()
// CompB.vue - will reuse the previous state and no new event listeners will be registered const {
x
,
y
} =
useSharedMouse
()

Type Declarations

ts
export type 
SharedComposableReturn
<
T
extends
AnyFn
=
AnyFn
> =
T
/** * Make a composable function usable with multiple Vue instances. * * @see https://vueuse.org/createSharedComposable * * @__NO_SIDE_EFFECTS__ */ export declare function
createSharedComposable
<
Fn
extends
AnyFn
>(
composable
:
Fn
,
):
SharedComposableReturn
<
Fn
>

Source

SourceDocs

Contributors

NoiseFan

Changelog

No recent changes

Released under the MIT License.