mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-31 16:02:29 +01:00
36 lines
800 B
JavaScript
36 lines
800 B
JavaScript
"use strict";
|
|
(function ($) {
|
|
|
|
var connection = $.connection('/signalr/series');
|
|
|
|
var _getStatus = function (status) {
|
|
switch (status) {
|
|
case 0:
|
|
return 'connecting';
|
|
case 1:
|
|
return 'connected';
|
|
case 2:
|
|
return 'reconnecting';
|
|
case 4:
|
|
return 'disconnected';
|
|
default:
|
|
throw 'invalid status ' + status;
|
|
}
|
|
|
|
};
|
|
|
|
connection.stateChanged(function (change) {
|
|
|
|
console.log('signalR [{0}]'.format(_getStatus(change.newState)));
|
|
});
|
|
|
|
connection.received(function (data) {
|
|
console.log(data);
|
|
});
|
|
|
|
connection.error(function (error) {
|
|
console.warn(error);
|
|
});
|
|
|
|
connection.start();
|
|
})(jQuery); |