fix: view.websocket (object to data)
This commit is contained in:
parent
ca3e25b0e7
commit
ec45b1c13a
|
@ -24,9 +24,17 @@ window.wsc_emergency = wsc.channel('emergency/31').listen(function(msg, err){
|
||||||
( new Audio('https://notificationsounds.com/message-tones/communication-channel-519/download/mp3') ).play();
|
( new Audio('https://notificationsounds.com/message-tones/communication-channel-519/download/mp3') ).play();
|
||||||
|
|
||||||
// {2} Add messages to stack //
|
// {2} Add messages to stack //
|
||||||
for( var id in msg.add )
|
for( var id in msg.add ){
|
||||||
if( gstore.data.notif.emergency.data[id] == null )
|
|
||||||
gstore.data.notif.emergency.data[id] = msg.add[id];
|
var tmp = msg.add[id]; // add id to data
|
||||||
|
tmp.id = id;
|
||||||
|
|
||||||
|
gstore.data.notif.emergency.data.push(tmp);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// if( gstore.data.notif.emergency.data[id] == null )
|
||||||
|
// gstore.data.notif.emergency.data[id] = msg.add[id];
|
||||||
|
|
||||||
// {3} Add notification count if not already on page //
|
// {3} Add notification count if not already on page //
|
||||||
if( router.app.$route.path != '/emergency' )
|
if( router.app.$route.path != '/emergency' )
|
||||||
|
@ -38,8 +46,8 @@ window.wsc_emergency = wsc.channel('emergency/31').listen(function(msg, err){
|
||||||
if( msg.del != null ){
|
if( msg.del != null ){
|
||||||
|
|
||||||
// {1} Rem messages from stack //
|
// {1} Rem messages from stack //
|
||||||
for( var id of msg.del )
|
for( var id of gstore.data.notif.emergency.data )
|
||||||
if( gstore.data.notif.emergency.data[id] != null )
|
if( msg.del.indexOf(gstore.data.notif.emergency.data[id].id) > -1 )
|
||||||
delete gstore.data.notif.emergency.data[id];
|
delete gstore.data.notif.emergency.data[id];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -48,9 +56,9 @@ window.wsc_emergency = wsc.channel('emergency/31').listen(function(msg, err){
|
||||||
if( msg.upd != null ){
|
if( msg.upd != null ){
|
||||||
|
|
||||||
// {1} Update messages in stack //
|
// {1} Update messages in stack //
|
||||||
for( var id of msg.upd )
|
for( var id of gstore.data.notif.emergency.data )
|
||||||
if( gstore.data.notif.emergency.data[id] != null )
|
if( msg.del.indexOf(gstore.data.notif.emergency.data[id].id) > -1 )
|
||||||
gstore.data.notif.emergency.data[id] = msg.upd[id];
|
gstore.data.notif.emergency.data[id] = msg.upd;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue