From c02253dc11019acc120c7e0859964f0adfdbaf20 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 4 Dec 2017 19:19:15 +0100 Subject: [PATCH] Added gstore func to send a message --- view/vue-config.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/view/vue-config.js b/view/vue-config.js index 3bb1534..1968300 100644 --- a/view/vue-config.js +++ b/view/vue-config.js @@ -5,8 +5,8 @@ window.gstore = new GlobalStore(); // Header window.gstore.add('header_title', 'ndli1718'); window.gstore.add('info', { - active: false, - type: 'warning', + active: false, + type: 'warning', message: 'Warning! blabla' }); window.gstore.add('notif', [ @@ -35,5 +35,12 @@ window.gstore.add('min_menu', true); // Functions window.gstore.add('func', { - toggleMenuSize: function(){ window.gstore.data.min_menu=!window.gstore.data.min_menu; } + toggleMenuSize: function(){ window.gstore.data.min_menu=!window.gstore.data.min_menu; }, + sendMessage: function(msg){ + /* (1) Send message to WebSocket */ + window.wsc_chat.send(JSON.stringify({message: msg})); + + /* (2) Add locally */ + window.gstore.data.notif[1].data.push([ window.gstore.data.server.session.name, msg ]); + } }); \ No newline at end of file