mirror of
https://github.com/tenrok/vue-native-websocket.git
synced 2026-06-25 04:10:35 +03:00
Make manually connection configurable
This commit is contained in:
@@ -8,6 +8,7 @@ export default {
|
|||||||
|
|
||||||
let observer = null
|
let observer = null
|
||||||
|
|
||||||
|
if (opts.connectManually) {
|
||||||
Vue.prototype.$connect = function () {
|
Vue.prototype.$connect = function () {
|
||||||
observer = new Observer(connection, opts)
|
observer = new Observer(connection, opts)
|
||||||
Vue.prototype.$socket = observer.WebSocket
|
Vue.prototype.$socket = observer.WebSocket
|
||||||
@@ -18,6 +19,10 @@ export default {
|
|||||||
Vue.prototype.$socket.close()
|
Vue.prototype.$socket.close()
|
||||||
delete Vue.prototype.$socket
|
delete Vue.prototype.$socket
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
observer = new Observer(connection, opts)
|
||||||
|
Vue.prototype.$socket = observer.WebSockekt
|
||||||
|
}
|
||||||
|
|
||||||
Vue.mixin({
|
Vue.mixin({
|
||||||
created () {
|
created () {
|
||||||
|
|||||||
Reference in New Issue
Block a user