Merge pull request #1 from ilcharle/ilcharle-patch-1

[FIX] mixin.js without namespaces
pull/254/head
Ian Charlesworth 4 years ago committed by GitHub
commit 9e9404af2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -7,7 +7,7 @@ export default {
if(!this.sockets) this.sockets = {};
if (typeof this.$vueSocketIo === 'object') {
if (this.$vueSocketIo.useConnectionNamespace) {
for (const namespace of Object.keys(this.$vueSocketIo)) {
this.sockets[namespace] = {
subscribe: (event, callback) => {
@ -19,8 +19,12 @@ export default {
}
}
} else {
this.$vueSocketIo.emitter.addListener(event, callback, this);
this.$vueSocketIo.emitter.removeListener(event, this);
this.sockets.subscribe = (event, callback) => {
this.$vueSocketIo.emitter.addListener(event, callback, this);
};
this.sockets.unsubscribe = (event) => {
this.$vueSocketIo.emitter.removeListener(event, this);
};
}
},
@ -31,7 +35,7 @@ export default {
if(this.$options.sockets){
if (typeof this.$vueSocketIo === 'object') {
if (this.$vueSocketIo.useConnectionNamespace) {
for (const namespace of Object.keys(this.$vueSocketIo)) {
if (this.$options.sockets[namespace]) {
Object.keys(this.$options.sockets[namespace]).forEach(event => {
@ -63,7 +67,7 @@ export default {
if(this.$options.sockets){
if (typeof this.$vueSocketIo === 'object') {
if (this.$vueSocketIo.useConnectionNamespace) {
for (const namespace of Object.keys(this.$vueSocketIo)) {
if (this.$options.sockets[namespace]) {
Object.keys(this.$options.sockets[namespace]).forEach(event => {
@ -85,4 +89,4 @@ export default {
}
}
}

Loading…
Cancel
Save