Invert if(query) test and queue("ready") wrapper.
authorMike Taylor <mike@indexdata.com>
Tue, 27 May 2014 15:46:11 +0000 (16:46 +0100)
committerMike Taylor <mike@indexdata.com>
Tue, 27 May 2014 15:46:11 +0000 (16:46 +0100)
src/mkws-widget.js

index 534e4b3..b676039 100644 (file)
@@ -134,8 +134,8 @@ widget.autosearch = function(widget) {
     }
   }
 
-  widget.team.queue("ready").subscribe(function() {
-    if (query) {
+  if (query) {
+    widget.team.queue("ready").subscribe(function() {
       var sortOrder = widget.config.sort;
       var maxrecs = widget.config.maxrecs;
       var perpage = widget.config.perpage;
@@ -155,8 +155,8 @@ widget.autosearch = function(widget) {
       widget.log(s);
 
       widget.team.newSearch(query, sortOrder, maxrecs, perpage, limit, targets, targetfilter);
-    }
-  });
+    });
+  }
 };