From e9416b5dce86fa909fe225180626ae6f28275bfe Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Sun, 27 Sep 2020 22:08:04 -0600 Subject: [PATCH] Adjust some mechanics --- src/main.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main.js b/src/main.js index 6911851..45bedcb 100644 --- a/src/main.js +++ b/src/main.js @@ -5,15 +5,13 @@ import VueSocketIO from 'vue-socket.io'; Vue.config.productionTip = false; let qs = new URLSearchParams(window.location.search); -let ws_uri; +let ws_uri = ``; if (qs.get(`ws-uri`)) { ws_uri = qs.get(`ws-uri`) if (!ws_uri.match(/^(wss?|https?):\/\//)) { ws_uri = `ws://${ws_uri}`; }; -} else { - ws_uri = `` -} +}; // http://localhost:8080/?ws-uri=localhost:3000 @@ -21,9 +19,15 @@ while (ws_uri.length == 0 || !ws_uri.match(/^(wss?|https?):\/\//)) { ws_uri = prompt("Input a websocket URI to connect to"); } +qs.set(`ws-uri`, ws_uri); +window.history.pushState({}, ``, `/?${qs.toString()}`) + + Vue.use(new VueSocketIO({ debug: true, connection: ws_uri })) -new Vue({render: h => h(App)}).$mount('#app'); \ No newline at end of file +new Vue({ + render: h => h(App), +}).$mount('#app'); \ No newline at end of file