X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fstore.js;h=a999b0ac989a1028419f619a3e2f065a56331f75;hp=070b22cc374b58c52187a87b8135f543f0ab8804;hb=cdb34c934db9f75fcc1d749b5dc23d7ea217a289;hpb=3cb412e96197807f2c991e61cad50626738a3b4f diff --git a/client/src/store.js b/client/src/store.js index 070b22cc..a999b0ac 100644 --- a/client/src/store.js +++ b/client/src/store.js @@ -13,6 +13,7 @@ export const store = settings: {}, lang: "", }, + socketCloseListener: null, initialize() { ajax("/variants", "GET", res => { this.state.variants = res.variantArray; }); let mysid = localStorage["mysid"]; @@ -48,10 +49,10 @@ export const store = highlight: !!eval(localStorage["highlight"]), sqSize: parseInt(localStorage["sqSize"]), }; - const socketCloseListener = () => { + this.socketCloseListener = () => { this.state.conn = new WebSocket(params.socketUrl + "/?sid=" + mysid); }; - this.state.conn.onclose = socketCloseListener; + this.state.conn.onclose = this.socketCloseListener; const supportedLangs = ["en","es","fr"]; this.state.lang = localStorage["lang"] || supportedLangs.includes(navigator.language)