Skip to content

chore: use hook type in options #284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/runtime-core/src/apiLifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ export const onUpdated = createHook(LifecycleHooks.UPDATED)
export const onBeforeUnmount = createHook(LifecycleHooks.BEFORE_UNMOUNT)
export const onUnmounted = createHook(LifecycleHooks.UNMOUNTED)

type DebuggerHook = (e: DebuggerEvent) => void
export type DebuggerHook = (e: DebuggerEvent) => void
export const onRenderTriggered = createHook<DebuggerHook>(
LifecycleHooks.RENDER_TRIGGERED
)
export const onRenderTracked = createHook<DebuggerHook>(
LifecycleHooks.RENDER_TRACKED
)

type ErrorCapturedHook = (
export type ErrorCapturedHook = (
err: Error,
instance: ComponentPublicInstance | null,
info: string
Expand Down
12 changes: 7 additions & 5 deletions packages/runtime-core/src/apiOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ import {
onRenderTracked,
onBeforeUnmount,
onUnmounted,
onRenderTriggered
onRenderTriggered,
DebuggerHook,
ErrorCapturedHook
} from './apiLifecycle'
import { DebuggerEvent, reactive } from '@vue/reactivity'
import { reactive } from '@vue/reactivity'
import { ComponentObjectPropsOptions, ExtractPropTypes } from './componentProps'
import { Directive } from './directives'
import { VNodeChild } from './vnode'
Expand Down Expand Up @@ -172,9 +174,9 @@ export interface LegacyOptions<
deactivated?(): void
beforeUnmount?(): void
unmounted?(): void
renderTracked?(e: DebuggerEvent): void
renderTriggered?(e: DebuggerEvent): void
errorCaptured?(): boolean | void
renderTracked?: DebuggerHook
renderTriggered?: DebuggerHook
errorCaptured?: ErrorCapturedHook
}

export function applyOptions(
Expand Down