if (type === 'Targets') {
promoteTargets();
+ } else if (type === 'Stat') {
+ promoteStat();
+ } else {
+ // Unsupported widget type: call an extension?
}
// ### More to do here, surely: e.g. wiring into the team
mkws.debug("made widget(team=" + team + ", type=" + type + ", node=" + node);
+
function promoteTargets() {
mkws.queue("targets").subscribe(function(data) {
if (node.length === 0) alert("huh?!");
});
}
+
+ function promoteStat() {
+ mkws.queue("stat").subscribe(function(data) {
+ if (node.length === 0) alert("huh?!");
+
+ $(node).html('<span class="head">' + M('Status info') + '</span>' +
+ ' -- ' +
+ '<span class="clients">' + M('Active clients') + ': ' + data.activeclients + '/' + data.clients + '</span>' +
+ ' -- ' +
+ '<span class="records">' + M('Retrieved records') + ': ' + data.records + '/' + data.hits + '</span>');
+ });
+ }
+
+
return that;
}
function onStat(data, teamName) {
debug("stat");
- var node = findnode('.mkwsStat');
- if (node.length === 0) return;
-
- node.html('<span class="head">' + M('Status info') + '</span>' +
- ' -- ' +
- '<span class="clients">' + M('Active clients') + ': ' + data.activeclients + '/' + data.clients + '</span>' +
- ' -- ' +
- '<span class="records">' + M('Retrieved records') + ': ' + data.records + '/' + data.hits + '</span>');
+ mkws.queue("stat").publish(data);
}