From: Mike Taylor Date: Tue, 8 Apr 2014 16:08:57 +0000 (+0100) Subject: onStat publishes a "complete" event when the number of active clients X-Git-Tag: 1.0.0~975^2~1 X-Git-Url: http://git.indexdata.com/?p=mkws-moved-to-github.git;a=commitdiff_plain;h=d386da0cff413ca9148aa1866dc0c1b7320be34d onStat publishes a "complete" event when the number of active clients falls to zero. This enables us to make a "search is complete" widget, which fixes bugs MKWS-48 and MKWS-49. --- diff --git a/src/mkws-team.js b/src/mkws-team.js index ee18f1b..4447457 100644 --- a/src/mkws-team.js +++ b/src/mkws-team.js @@ -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) {