Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Selects and applies VueUse composables for Vue.js and Nuxt projects.
83% 96%+13 ptsof test cases passed
Passed 22 of 23 test cases with the skill, and 19 of 23 without it.
3 of 3 safety checks passed
35 agent runs
2 forksA fork is a copy of this skill that someone made so they could edit it for their own use. The original doesn't change.
Make a composable function usable with multiple Vue instances.
[!WARNING] When used in a SSR environment,
createSharedComposablewill automatically fallback to a non-shared version. This means every call will create a fresh instance in SSR to avoid cross-request state pollution.
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()
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,
Next to this one in the catalogue, plus more from the same author.