From 4486a21e09c50f65da5d4c3648430cea1b19a0cc Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Sat, 4 May 2019 16:30:11 +0200 Subject: [PATCH] Move some comments, and remove some of them --- client/src/main.js | 31 ------------------------------- client/src/playCompMove.js | 6 +----- client/src/router.js | 5 +++++ client/src/store.js | 1 + client/src/views/MyGames.vue | 5 +++++ 5 files changed, 12 insertions(+), 36 deletions(-) create mode 100644 client/src/views/MyGames.vue diff --git a/client/src/main.js b/client/src/main.js index 6547865a..08893dbc 100644 --- a/client/src/main.js +++ b/client/src/main.js @@ -1,7 +1,6 @@ import Vue from "vue"; import App from "./App.vue"; import router from "./router"; -// Global store: see https://medium.com/fullstackio/managing-state-in-vue-js-23a0352b1c87 import { store } from "./store"; Vue.config.productionTip = false; @@ -11,38 +10,8 @@ new Vue({ render: function(h) { return h(App); }, -// watch: { -// $route: function(newRoute) { -// //console.log(this.$route.params); -// console.log("navig to " + newRoute); -// //TODO: conn.send("enter", newRoute) -// }, -// }, created: function() { window.doClick = (elemId) => { document.getElementById(elemId).click() }; store.initialize(); - - // TODO: AJAX call get corr games (all variants) - // si dernier lastMove sur serveur n'est pas le mien et nextColor == moi, alors background orange - // ==> background orange si à moi de jouer par corr (sur main index) - // (helper: static fonction "GetNextCol()" dans base_rules.js) - - //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é) -// if (!!localStorage["variant"]) -// location.hash = "#game?id=" + localStorage["gameId"]; }, }).$mount("#app"); - -// board2, 3, 4 automatiquement, mais rules separement (les 3 pour une) -// game : aussi systématique -// problems: on-demand -// -// See https://router.vuejs.org/guide/essentials/dynamic-matching.html#reacting-to-params-changes -// created: function() { -// window.onhashchange = this.setDisplay; -// }, -//}); diff --git a/client/src/playCompMove.js b/client/src/playCompMove.js index 062eae35..b93a8d1e 100644 --- a/client/src/playCompMove.js +++ b/client/src/playCompMove.js @@ -1,8 +1,4 @@ -// TODO: https://github.com/webpack-contrib/worker-loader -// https://stackoverflow.com/questions/48713072/how-to-get-js-function-into-webworker-via-importscripts -// For asynchronous computer move search - -//self.addEventListener('message', (e) => +// Logic to play a computer move in a web worker onmessage = async function(e) { switch (e.data[0]) diff --git a/client/src/router.js b/client/src/router.js index 5879a1e8..184fede0 100644 --- a/client/src/router.js +++ b/client/src/router.js @@ -77,6 +77,11 @@ router.beforeEach((to, from, next) => { window.scrollTo(0, 0); //TODO: check if a live game is running; if yes, call next('/game') //https://router.vuejs.org/guide/advanced/navigation-guards.html#global-before-guards next(); + //TODO: si une partie en cours dans storage, rediriger vers cette partie + //(à condition que l'URL n'y corresponde pas déjà !) + // (l'identifiant de l'utilisateur si connecté) +// if (!!localStorage["variant"]) +// location.hash = "#game?id=" + localStorage["gameId"]; }); export default router; diff --git a/client/src/store.js b/client/src/store.js index 9d1c6e62..055fff9d 100644 --- a/client/src/store.js +++ b/client/src/store.js @@ -2,6 +2,7 @@ import { ajax } from "./utils/ajax"; import { getRandString } from "./utils/alea"; import params from "./parameters"; //for socket connection +// Global store: see https://medium.com/fullstackio/managing-state-in-vue-js-23a0352b1c87 export const store = { state: { diff --git a/client/src/views/MyGames.vue b/client/src/views/MyGames.vue new file mode 100644 index 00000000..ddb689d0 --- /dev/null +++ b/client/src/views/MyGames.vue @@ -0,0 +1,5 @@ + // TODO: AJAX call get corr games (all variants) + // si dernier lastMove sur serveur n'est pas le mien et nextColor == moi, alors background orange + // ==> background orange si à moi de jouer par corr (sur main index) + // (helper: static fonction "GetNextCol()" dans base_rules.js) + -- 2.44.0