Skip to content

Commit 70a7c4e

Browse files
patinthehatPatrick
authored andcommitted
make mixin code for conditional events more testable
1 parent a1f3e87 commit 70a7c4e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/v3/Vue3RayMixin.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import { VueRay } from '../shared/VueRay';
33

44
export let vue3Watch = null;
55

6-
const conditionallyDisplayEvent = (eventName: string, options: Record<string, unknown>) => {
6+
const conditionallyDisplayEvent = (eventName: string, options: Record<string, unknown>, rayInstance: any = null) => {
77
if (VueRay.shouldDisplayEvent(eventName)) {
8-
this.$ray().table([
8+
rayInstance = rayInstance ?? this.$ray ?? Vue3RayMixin.methods.$ray;
9+
10+
rayInstance().table([
911
`component ${eventName}: <code>${options.name}</code>`,
1012
`filename: <code>&lt;project root&gt;/${options.__file}</code>`,
1113
]);

0 commit comments

Comments
 (0)