Skip to content

Commit 42762b9

Browse files
authored
Merge pull request #248 from gzponline/delete-functionalComponentEmits
fix: delete useless code
2 parents 951c501 + f4196d2 commit 42762b9

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/mount.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,6 @@ export function mount(
238238
// normalise the incoming component
239239
let component
240240

241-
const functionalComponentEmits: Record<string, unknown[]> = {}
242-
243241
if (isFunctionalComponent(originalComponent)) {
244242
// we need to wrap it like this so we can capture emitted events.
245243
// we capture events using a mixin that mutates `emit` in `beforeCreate`,
@@ -422,7 +420,7 @@ export function mount(
422420
const vm = app.mount(el)
423421

424422
const App = vm.$refs[MOUNT_COMPONENT_REF] as ComponentPublicInstance
425-
return createWrapper(app, App, setProps, functionalComponentEmits)
423+
return createWrapper(app, App, setProps)
426424
}
427425

428426
export const shallowMount: typeof mount = (component: any, options?: any) => {

src/vueWrapper.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,17 @@ export class VueWrapper<T extends ComponentPublicInstance> {
1414
private rootVM: ComponentPublicInstance
1515
private __app: App | null
1616
private __setProps: ((props: Record<string, any>) => void) | undefined
17-
private __functionalEmits: Record<string, unknown[]>
1817

1918
constructor(
2019
app: App | null,
2120
vm: ComponentPublicInstance,
22-
setProps?: (props: Record<string, any>) => void,
23-
functionalEmits?: Record<string, unknown[]>
21+
setProps?: (props: Record<string, any>) => void
2422
) {
2523
this.__app = app
2624
// root is null on functional components
2725
this.rootVM = vm?.$root
2826
this.componentVM = vm as T
2927
this.__setProps = setProps
30-
this.__functionalEmits = functionalEmits
3128
// plugins hook
3229
config.plugins.VueWrapper.extend(this)
3330
}
@@ -247,8 +244,7 @@ export class VueWrapper<T extends ComponentPublicInstance> {
247244
export function createWrapper<T extends ComponentPublicInstance>(
248245
app: App | null,
249246
vm: ComponentPublicInstance,
250-
setProps?: (props: Record<string, any>) => void,
251-
functionalComponentEmits?: Record<string, unknown[]>
247+
setProps?: (props: Record<string, any>) => void
252248
): VueWrapper<T> {
253-
return new VueWrapper<T>(app, vm, setProps, functionalComponentEmits)
249+
return new VueWrapper<T>(app, vm, setProps)
254250
}

0 commit comments

Comments
 (0)