feat(devtools): catch events

This commit is contained in:
Guillaume Chau
2020-08-24 01:31:32 +02:00
parent 10293c7a18
commit 23233dc8b8
2 changed files with 22 additions and 1 deletions

View File

@@ -13,6 +13,7 @@ import { callWithAsyncErrorHandling, ErrorCodes } from './errorHandling'
import { warn } from './warning'
import { normalizePropsOptions } from './componentProps'
import { UnionToIntersection } from './helpers/typeUtils'
import { devtoolsComponentEmit } from './devtools'
export type ObjectEmitsOptions = Record<
string,
@@ -67,6 +68,10 @@ export function emit(
}
}
if (__DEV__ || __FEATURE_PROD_DEVTOOLS__) {
devtoolsComponentEmit(instance, event, args)
}
let handlerName = `on${capitalize(event)}`
let handler = props[handlerName]
// for v-model update:xxx events, also trigger kebab-case equivalent