2
0
mirror of https://github.com/tenrok/vue-native-websocket.git synced 2026-06-07 12:42:26 +03:00

Fixed context for events calback

This commit is contained in:
n5leon
2017-11-18 17:02:08 +01:00
parent ce215a109e
commit f30c155298
2 changed files with 4 additions and 3 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+3 -2
View File
@@ -12,16 +12,17 @@ export default {
Vue.mixin({
created () {
let vm = this
let sockets = this.$options['sockets']
this.$options.sockets = new Proxy({}, {
set (target, key, value) {
Emitter.addListener(key, value, this)
Emitter.addListener(key, value, vm)
target[key] = value
return true
},
deleteProperty (target, key) {
Emitter.removeListener(key, this.$options.sockets[key], this)
Emitter.removeListener(key, vm.$options.sockets[key], vm)
delete target.key
return true
}