- //alert("test");
- ajax("http://localhost:3000/variants", "GET", variantArray => {
- console.log("Got variants:");
- console.log(variantArray);
- });
+ const supportedLangs = ["en","es","fr"];
+ Vue.prototype.$lang = localStorage["lang"] ||
+ supportedLangs.includes(navigator.language)
+ ? navigator.language
+ : "en";
+ 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)
+ Vue.prototype.$conn = new WebSocket(params.socketUrl + "/?sid=" + myid);
+ //TODO: si une partie en cours dans storage, rediriger vers cette partie
+ //(à condition que l'URL n'y corresponde pas déjà !)
+ // TODO: à l'arrivée sur le site : set peerID (un identifiant unique
+ // en tout cas...) si pas trouvé dans localStorage "myid"
+ // (l'identifiant de l'utilisateur si connecté)