MCPcopy
hub / github.com/vuejs/core / createHook

Function createHook

packages/runtime-core/src/apiLifecycle.ts:67–79  ·  view source on GitHub ↗
(lifecycle: LifecycleHooks)

Source from the content-addressed store, hash-verified

65
66const createHook =
67 <T extends Function = () => any>(lifecycle: LifecycleHooks) =>
68 (
69 hook: T,
70 target: ComponentInternalInstance | null = currentInstance,
71 ): void => {
72 // post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
73 if (
74 !isInSSRComponentSetup ||
75 lifecycle === LifecycleHooks.SERVER_PREFETCH
76 ) {
77 injectHook(lifecycle, (...args: unknown[]) => hook(...args), target)
78 }
79 }
80type CreateHook<T = any> = (
81 hook: T,
82 target?: ComponentInternalInstance | null,

Callers 1

apiLifecycle.tsFile · 0.85

Calls 1

injectHookFunction · 0.85

Tested by

no test coverage detected