pz2 object is now created from contructed parameter array.
[mkws-moved-to-github.git] / src / mkws-team.js
index a8383e0..070f21d 100644 (file)
@@ -64,17 +64,17 @@ mkws.makeTeam = function($, teamName) {
   //    team.queue("eventName").subscribe(function(param1, param2 ...) { ... });
   //    team.queue("eventName").publish(arg1, arg2, ...);
   //
-  var queues = {};
+  var m_queues = {};
   function queue(id) {
-    if (!queues[id]) {
+    if (!m_queues[id]) {
       var callbacks = $.Callbacks();
-      queues[id] = {
+      m_queues[id] = {
         publish: callbacks.fire,
         subscribe: callbacks.add,
         unsubscribe: callbacks.remove
       };
     }
-    return queues[id];
+    return m_queues[id];
   };
   that.queue = queue;
 
@@ -154,19 +154,24 @@ mkws.makeTeam = function($, teamName) {
   // then register the form submit event with the pz2.search function
   // autoInit is set to true on default
   that.makePz2 = function() {
-    m_paz = new pz2({ "windowid": teamName,
-                      "pazpar2path": mkws.pazpar2_url(),
-                      "usesessions" : config.use_service_proxy ? false : true,
-                      "oninit": onInit,
-                      "onbytarget": onBytarget,
-                      "onstat": onStat,
-                      "onterm": (config.facets.length ? onTerm : undefined),
-                      "onshow": onShow,
-                      "onrecord": onRecord,
-                      "showtime": 500,            //each timer (show, stat, term, bytarget) can be specified this way
-                      "termlist": config.facets.join(',')
-                    });
-    log("created main pz2 object");
+    log("m_queues=" + $.toJSON(m_queues));
+    var params = {
+      "windowid": teamName,
+      "pazpar2path": mkws.pazpar2_url(),
+      "usesessions" : config.use_service_proxy ? false : true,
+      "showtime": 500,            //each timer (show, stat, term, bytarget) can be specified this way
+      "termlist": config.facets.join(',')
+    };
+
+    params.oninit = onInit;
+    params.onbytarget = onBytarget;
+    params.onstat = onStat;
+    params.onterm = (config.facets.length ? onTerm : undefined);
+    params.onshow = onShow;
+    params.onrecord = onRecord;
+
+    m_paz = new pz2(params);
+    log("ccreated main pz2 object");
   }