MCPcopy
hub / github.com/vuejs/composition-api / wrapHookCall

Function wrapHookCall

src/apis/lifecycle.ts:34–47  ·  view source on GitHub ↗
(
  instance: ComponentInternalInstance,
  fn: Function
)

Source from the content-addressed store, hash-verified

32}
33
34function wrapHookCall(
35 instance: ComponentInternalInstance,
36 fn: Function
37): Function {
38 return (...args: any) => {
39 let prev = getCurrentInstance()
40 setCurrentInstance(instance)
41 try {
42 return fn(...args)
43 } finally {
44 setCurrentInstance(prev)
45 }
46 }
47}
48
49export const onBeforeMount = createLifeCycle('beforeMount')
50export const onMounted = createLifeCycle('mounted')

Callers 1

injectHookOptionFunction · 0.85

Calls 2

getCurrentInstanceFunction · 0.90
setCurrentInstanceFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…