wide/static/js/notification.js

28 lines
802 B
JavaScript
Raw Normal View History

2014-09-17 06:54:57 +04:00
var notificationWS = new WebSocket(config.channel.shell + '/notification/ws?sid=' + config.wideSessionId);
2014-09-15 14:03:52 +04:00
notificationWS.onopen = function() {
console.log('[notification onopen] connected');
};
notificationWS.onmessage = function(e) {
console.log('[notification onmessage]' + e.data);
var data = JSON.parse(e.data);
if ('init-notification' !== data.cmd) {
2014-09-17 06:10:26 +04:00
$('.bottom-window-group .notification').val(data.output);
2014-09-15 14:03:52 +04:00
}
};
notificationWS.onclose = function(e) {
console.log('[notification onclose] disconnected (' + e.code + ')');
delete notificationWS;
};
notificationWS.onerror = function(e) {
console.log('[notification onerror] ' + e);
};
var notification = {
init: function() {
}
};
$(document).ready(function() {
notification.init();
});