Added gstore func to send a message

This commit is contained in:
xdrm-brackets 2017-12-04 19:19:15 +01:00
parent 64d04d83b9
commit c02253dc11
1 changed files with 10 additions and 3 deletions

View File

@ -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 ]);
}
});