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