Skip to content

Commit 01fcadb

Browse files
committed
fix $emit patch compatibility with 1.x
1 parent 2be58c2 commit 01fcadb

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/backend/events.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,21 @@ export function initEventsBackend (Vue, bridge, getInstanceName) {
99

1010
const vueEmit = Vue.prototype.$emit
1111
Vue.prototype.$emit = function () {
12-
vueEmit.apply(this, arguments)
12+
const res = vueEmit.apply(this, arguments)
1313

14-
if (!recording) return
15-
const eventName = arguments[0]
16-
if (!eventName.startsWith('hook:')) {
17-
bridge.send('event:emit', stringify({
18-
instanceId: this._uid,
19-
instanceName: getInstanceName(this),
20-
eventName: eventName,
21-
eventData: arguments[1],
22-
timestamp: Date.now()
23-
}))
14+
if (recording) {
15+
const eventName = arguments[0]
16+
if (!eventName.startsWith('hook:')) {
17+
bridge.send('event:emit', stringify({
18+
instanceId: this._uid,
19+
instanceName: getInstanceName(this),
20+
eventName: eventName,
21+
eventData: arguments[1],
22+
timestamp: Date.now()
23+
}))
24+
}
2425
}
26+
27+
return res
2528
}
2629
}

0 commit comments

Comments
 (0)