1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-30 17:30:59 +01:00
phorge-phorge/webroot/rsrc/js/application/aphlict/behavior-aphlict-status.js
Joshua Spence f55647736a Minor tidying of Aphlict code
Summary: Just some housekeeping... mostly just removing some unused variables.

Test Plan: Checked that I was still about to receive notifications from `/notification/status/`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11398
2015-01-15 08:08:08 +11:00

39 lines
761 B
JavaScript

/**
* @provides javelin-behavior-aphlict-status
* @requires javelin-behavior
* javelin-aphlict
* phabricator-phtize
* javelin-dom
* @javelin
*/
JX.behavior('aphlict-status', function(config) {
var pht = JX.phtize(config.pht);
function update() {
var client = JX.Aphlict.getInstance();
if (!client) {
return;
}
var node;
try {
node = JX.$(config.nodeID);
} catch (ignored) {
return;
}
var status = client.getStatus();
var status_node = JX.$N(
'span',
{
className: 'aphlict-connection-status-' + status
},
pht(status));
JX.DOM.setContent(node, status_node);
}
JX.Aphlict.listen('didChangeStatus', update);
update();
});