VNodeChildren,
Fragment,
Portal,
- isVNode
+ isVNode,
+ Suspense
} from './vnode'
import { isObject, isArray } from '@vue/shared'
import { Ref } from '@vue/reactivity'
children?: RawChildren
): VNode
+// suspense
+export function h(type: typeof Suspense, children?: RawChildren): VNode
+export function h(
+ type: typeof Suspense,
+ props?:
+ | (RawProps & {
+ onResolve?: () => void
+ onRecede?: () => void
+ })
+ | null,
+ children?: RawChildren | RawSlots
+): VNode
+
// functional component
export function h(type: FunctionalComponent, children?: RawChildren): VNode
export function h<P>(
isUnmounted: boolean
effects: Function[]
resolve(): void
- restart(): void
+ recede(): void
move(container: HostElement, anchor: HostNode | null): void
next(): HostNode | null
registerDep(
}
},
- restart() {
+ recede() {
suspense.isResolved = false
const {
vnode,
updateHOCHostEl(parentComponent, el)
}
- // invoke @suspense event
- const onSuspense = vnode.props && vnode.props.onSuspense
- if (isFunction(onSuspense)) {
- onSuspense()
+ // invoke @recede event
+ const onRecede = vnode.props && vnode.props.onRecede
+ if (isFunction(onRecede)) {
+ onRecede()
}
},
// suspense tree
if (suspense.isResolved) {
queueJob(() => {
- suspense.restart()
+ suspense.recede()
})
}
export const Text = Symbol(__DEV__ ? 'Text' : undefined)
export const Comment = Symbol(__DEV__ ? 'Comment' : undefined)
-const Suspense = __FEATURE_SUSPENSE__ ? SuspenseImpl : null
+const Suspense = (__FEATURE_SUSPENSE__
+ ? SuspenseImpl
+ : null) as typeof SuspenseImpl
export { Suspense }
export type VNodeTypes =