Added gstore func to send a message
This commit is contained in:
parent
64d04d83b9
commit
c02253dc11
|
@ -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 ]);
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue