Comment
[mkws-moved-to-github.git] / src / mkws-team.js
index ee18f1b..d4bdc8e 100644 (file)
@@ -48,12 +48,12 @@ function team($, teamName) {
 
 
     // The following PubSub code is modified from the jQuery manual:
-    // https://api.jquery.com/jQuery.Callbacks/
+    // http://api.jquery.com/jQuery.Callbacks/
     //
     // Use as:
     // team.queue("eventName").subscribe(function(param1, param2 ...) { ... });
     // team.queue("eventName").publish(arg1, arg2, ...);
-
+    //
     var queues = {};
     function queue(id) {
        if (!queues[id]) {
@@ -115,8 +115,9 @@ function team($, teamName) {
     }
 
     function onStat(data) {
-       log("stat");
        queue("stat").publish(data);
+       if (parseInt(data.activeclients[0], 10) === 0)
+           queue("complete").publish(parseInt(data.hits[0], 10));
     }
 
     function onTerm(data) {