cleanup spin functions - actually use our defaults - provide means to tweak defaults...
[unfold.git] / manifold / static / js / manifold.js
index 1bb5b97..df8955d 100644 (file)
@@ -186,19 +186,6 @@ var manifold = {
 
     separator: '__',
 
-    spin_presets: {},
-
-    spin: function(locator, active /*= true */) {
-        active = typeof active !== 'undefined' ? active : true;
-        try {
-            if (active) {
-                $(locator).spin(manifold.spin_presets);
-            } else {
-                $(locator).spin(false);
-            }
-        } catch (err) { messages.debug("Cannot turn spins on/off " + err); }
-    },
-
     get_type: function(variable) {
         switch(Object.toType(variable)) {
             case 'number':
@@ -317,7 +304,7 @@ var manifold = {
     // reasonably low-noise, shows manifold requests coming in and out
     asynchroneous_debug : true,
     // print our more details on result publication and related callbacks
-    publish_result_debug : false,
+    publish_result_debug : true,
 
     /**
      * \brief We use js function closure to be able to pass the query (array)
@@ -417,19 +404,21 @@ var manifold = {
             count += 1;
         });
         if (manifold.publish_result_debug) 
-            messages.debug(".. publish_result NEW API (2) count=" + count);
+            messages.debug(".. publish_result (2) has used NEW API on " + count + " records");
         manifold.raise_record_event(query.query_uuid, DONE);
+        if (manifold.publish_result_debug) 
+            messages.debug(".. publish_result (3) has used NEW API to say DONE");
 
         // OLD PLUGIN API BELOW
         /* Publish an update announce */
         var channel="/results/" + query.query_uuid + "/changed";
         if (manifold.publish_result_debug) 
-            messages.debug(".. publish_result OLD API (3) " + channel);
+            messages.debug(".. publish_result (4) OLD API on channel" + channel);
 
         $.publish(channel, [result, query]);
 
         if (manifold.publish_result_debug) 
-            messages.debug(".. publish_result - END (4) q=" + query.__repr());
+            messages.debug(".. publish_result (5) END q=" + query.__repr());
     },
 
     /*!
@@ -736,7 +725,7 @@ var manifold = {
         }
 
         if (manifold.asynchroneous_debug) 
-            messages.debug ("========== asynchroneous_success " + query.object + " -- before process_query_records");
+            messages.debug ("========== asynchroneous_success " + query.object + " -- before process_query_records [" + query.query_uuid +"]");
 
         // once everything is checked we can use the 'value' part of the manifoldresult
         var result=data.value;
@@ -760,10 +749,12 @@ var manifold = {
      **************************************************************************/ 
 
     raise_event_handler: function(type, query_uuid, event_type, value) {
+       if (manifold.publish_result_debug)
+           messages.debug("raise_event_handler, quuid="+query_uuid+" type="+type+" event_type="+event_type);
         if ((type != 'query') && (type != 'record'))
             throw 'Incorrect type for manifold.raise_event()';
         // xxx we observe quite a lot of incoming calls with an undefined query_uuid
-        // this should be fixed upstream
+        // this should be fixed upstream in manifold I expect
         if (query_uuid === undefined) {
             messages.warning("undefined query in raise_event_handler");
             return;
@@ -775,9 +766,11 @@ var manifold = {
 
         $.each(channels, function(i, channel) {
             if (value === undefined) {
-                $('.plugin').trigger(channel, [event_type]);
+               if (manifold.publish_result_debug) messages.debug("triggering [no value] on channel="+channel+" and event_type="+event_type);
+                $('.pubsub').trigger(channel, [event_type]);
             } else {
-                $('.plugin').trigger(channel, [event_type, value]);
+               if (manifold.publish_result_debug) messages.debug("triggering [value="+value+"] on channel="+channel+" and event_type="+event_type);
+                $('.pubsub').trigger(channel, [event_type, value]);
             }
         });
     },