};
-// The following PubSub code is modified from the jQuery manual:
-// https://api.jquery.com/jQuery.Callbacks/
-//
-// Use as:
-// mkws.queue("eventName").subscribe(function(param1, param2 ...) { ... });
-// mkws.queue("eventName").publish(arg1, arg2, ...);
-
-(function() {
- var queues = {};
- mkws.queue = function(id) {
- if (!queues[id]) {
- var callbacks = $.Callbacks();
- queues[id] = {
- publish: callbacks.fire,
- subscribe: callbacks.add,
- unsubscribe: callbacks.remove
- };
- }
- return queues[id];
- }
-}());
-
-
// Define empty mkws_config for simple applications that don't define it.
if (mkws_config == null || typeof mkws_config != 'object') {
var mkws_config = {};
function promoteTargets() {
- mkws.queue("targets." + team.name()).subscribe(function(data) {
+ team.queue("targets").subscribe(function(data) {
if (node.length === 0) alert("huh?!");
var table ='<table><thead><tr>' +
function promoteStat() {
- mkws.queue("stat." + team.name()).subscribe(function(data) {
+ team.queue("stat").subscribe(function(data) {
if (node.length === 0) alert("huh?!");
$(node).html('<span class="head">' + M('Status info') + '</span>' +
function onBytarget(data) {
debug("target");
- mkws.queue("targets." + m_teamName).publish(data);
+ queue("targets").publish(data);
}
function onStat(data) {
debug("stat");
- mkws.queue("stat." + m_teamName).publish(data);
+ queue("stat").publish(data);
}
}
+ // The following PubSub code is modified from the jQuery manual:
+ // https://api.jquery.com/jQuery.Callbacks/
+ //
+ // Use as:
+ // team.queue("eventName").subscribe(function(param1, param2 ...) { ... });
+ // team.queue("eventName").publish(arg1, arg2, ...);
+
+ var queues = {};
+ var queue = function(id) {
+ if (!queues[id]) {
+ var callbacks = $.Callbacks();
+ queues[id] = {
+ publish: callbacks.fire,
+ subscribe: callbacks.add,
+ unsubscribe: callbacks.remove
+ };
+ }
+ return queues[id];
+ }
+
+ that.queue = queue;
+
+
// main
(function() {
try {