( hook: string, target?: ComponentInternalInstance | null )
| 9 | import { warn } from './utils' |
| 10 | |
| 11 | export function getCurrentInstanceForFn( |
| 12 | hook: string, |
| 13 | target?: ComponentInternalInstance | null |
| 14 | ): ComponentInternalInstance | null { |
| 15 | target = target || getCurrentInstance() |
| 16 | if (__DEV__ && !target) { |
| 17 | warn( |
| 18 | `${hook} is called when there is no active component instance to be ` + |
| 19 | `associated with. ` + |
| 20 | `Lifecycle injection APIs can only be used during execution of setup().` |
| 21 | ) |
| 22 | } |
| 23 | return target |
| 24 | } |
| 25 | |
| 26 | export function defineComponentInstance<V extends Vue = Vue>( |
| 27 | Ctor: VueConstructor<V>, |
no test coverage detected
searching dependent graphs…