X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fmain.js;h=4659a5b0f2e014c940649d7438dd364f179916eb;hb=590b75f9860a539d11906521fd25cacad05ab0a8;hp=da3e60220a3782dc984d4c3e490fceca4858eba6;hpb=98db2082fd31e7a7bc0348e31ce119f39dbc31b3;p=vchess.git diff --git a/client/src/main.js b/client/src/main.js index da3e6022..4659a5b0 100644 --- a/client/src/main.js +++ b/client/src/main.js @@ -24,6 +24,10 @@ new Vue({ Vue.prototype.$tr = tModule.translations; //console.log(tModule.translations); }, + $route: function(newRoute) { + console.log(this.$route.params); + //TODO: conn.send("enter", newRoute) + }, }, created: function() { const supportedLangs = ["en","es","fr"]; @@ -31,10 +35,9 @@ new Vue({ supportedLangs.includes(navigator.language) ? navigator.language : "en"; - ajax("/variants", "GET", res => { - Vue.prototype.$variants = res.variantArray; - }); + ajax("/variants", "GET", res => { Vue.prototype.$variants = res.variantArray; }); Vue.prototype.$tr = {}; //to avoid a compiler error + // TODO: if there is a socket ID in localStorage, it means a live game was interrupted (and should resume) const myid = localStorage["myid"] || util.getRandString(); // NOTE: in this version, we don't say on which page we are, yet // ==> we'll say "enter/leave" page XY (in fact juste "enter", seemingly) @@ -62,10 +65,4 @@ new Vue({ // game : aussi systématique // problems: on-demand // -// It works (to watch for route change), in a component: -//watch: { -// $route: function(newRoute) { -// console.log(this.$route.params); -// }, -//}, // See https://router.vuejs.org/guide/essentials/dynamic-matching.html#reacting-to-params-changes