Faster game start for accepted live challenges
[vchess.git] / client / src / main.js
CommitLineData
625022fd
BA
1import Vue from "vue";
2import App from "./App.vue";
3import router from "./router";
c66a829b 4import { store } from "./store";
625022fd
BA
5
6Vue.config.productionTip = false;
7
8new Vue({
9 router,
10 render: function(h) {
11 return h(App);
98db2082 12 },
c66a829b 13 created: function() {
afde7666 14 // Several interactions on clicks on elements:
6808d7a1
BA
15 window.doClick = elemId => {
16 document.getElementById(elemId).click();
17 };
1ef65040 18 // Esc key can close some modals:
6808d7a1
BA
19 document.addEventListener("keydown", e => {
20 if (e.code === "Escape") {
63ca2b89
BA
21 let modalBoxes = document.querySelectorAll("[id^='modal']");
22 modalBoxes.forEach(m => {
5b4de147
BA
23 if (
24 m.checked &&
1ef65040
BA
25 !["modalAccept", "modalConfirm", "modalChat", "modalPeople"]
26 .includes(m.id)
5b4de147
BA
27 ) {
28 m.checked = false;
29 }
63ca2b89
BA
30 });
31 }
32 });
8418f0d7 33 store.initialize();
6808d7a1 34 }
625022fd 35}).$mount("#app");