MCPcopy
hub / github.com/vueuse/vueuse / tryOnMounted

Function tryOnMounted

packages/shared/tryOnMounted/index.ts:14–22  ·  view source on GitHub ↗
(fn: Fn, sync = true, target?: ComponentInternalInstance | null)

Source from the content-addressed store, hash-verified

12 * @param target
13 */
14export function tryOnMounted(fn: Fn, sync = true, target?: ComponentInternalInstance | null) {
15 const instance = getLifeCycleTarget(target)
16 if (instance)
17 onMounted(fn, target)
18 else if (sync)
19 fn()
20 else
21 nextTick(fn)
22}

Callers 15

useMouseInElementFunction · 0.90
useBroadcastChannelFunction · 0.90
useBreakpointsFunction · 0.90
useScreenSafeAreaFunction · 0.90
useWindowSizeFunction · 0.90
useBluetoothFunction · 0.90
useParentElementFunction · 0.90
useStorageFunction · 0.90
useTextDirectionFunction · 0.90
useAnimateFunction · 0.90
useWebNotificationFunction · 0.90
useFullscreenFunction · 0.90

Calls 2

getLifeCycleTargetFunction · 0.90
fnFunction · 0.85

Tested by

no test coverage detected