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

release 10

This commit is contained in:
Viktor Scheglov
2018-09-12 16:46:12 +03:00
parent 2835a4b79a
commit 6891ca2e81
4 changed files with 7650 additions and 5 deletions
+6 -4
View File
@@ -3,10 +3,12 @@ import Emitter from './Emitter'
export default class {
constructor (connectionUrl, opts = {}) {
this.format = opts.format && opts.format.toLowerCase()
if(connectionUrl.startsWith('//')){
const scheme = window.location.protocol === 'https:' ? 'wss' : 'ws';
if (connectionUrl.startsWith('//')) {
const scheme = window.location.protocol === 'https:' ? 'wss' : 'ws'
connectionUrl = `${scheme}://${connectionUrl}`
}
this.connectionUrl = connectionUrl
this.opts = opts
@@ -93,9 +95,9 @@ export default class {
}
}
if (this.mutations) {
this.store[this.mutations[method] || method](target, msg)
this.store[this.mutations[method] || method](target, msg)
} else {
this.store[method](target, msg)
this.store[method](target, msg)
}
}
}