refactor: tweaks

This commit is contained in:
Evan You
2019-11-22 23:32:53 -05:00
parent 1b8236615e
commit a6aa64b0cc
5 changed files with 16 additions and 22 deletions

View File

@@ -28,6 +28,7 @@ import {
} from '@vue/shared'
import { SuspenseBoundary } from './components/Suspense'
import { CompilerError, CompilerOptions } from '@vue/compiler-core'
import { currentRenderingInstance } from './componentRenderUtils'
export type Data = { [key: string]: unknown }
@@ -112,6 +113,7 @@ export interface ComponentInternalInstance {
sink: { [key: string]: any }
// lifecycle
isMounted: boolean
isUnmounted: boolean
isDeactivated: boolean
[LifecycleHooks.BEFORE_CREATE]: LifecycleHook
@@ -179,6 +181,7 @@ export function createComponentInstance(
// lifecycle hooks
// not using enums here because it results in computed properties
isMounted: false,
isUnmounted: false,
isDeactivated: false,
bc: null,
@@ -217,7 +220,7 @@ export let currentInstance: ComponentInternalInstance | null = null
export let currentSuspense: SuspenseBoundary | null = null
export const getCurrentInstance: () => ComponentInternalInstance | null = () =>
currentInstance
currentInstance || currentRenderingInstance
export const setCurrentInstance = (
instance: ComponentInternalInstance | null