Less verbose logging when a widget makes new HTML on creation.
[mkws-moved-to-github.git] / src / mkws-team.js
index 213b14b..c6c5490 100644 (file)
@@ -430,20 +430,23 @@ function team($, teamName) {
     that.addWidget = function(w) {
         if (!m_widgets[w.type]) {
             m_widgets[w.type] = w;
-            log("Added '" + w.type + "' widget to team '" + m_teamName + "'");
+            //log("Added '" + w.type + "' widget to team '" + m_teamName + "'");
         } else if (typeof(m_widgets[w.type]) !== 'number') {
             m_widgets[w.type] = 2;
-            log("Added duplicate '" + w.type + "' widget to team '" + m_teamName + "'");
+            //log("Added duplicate '" + w.type + "' widget to team '" + m_teamName + "'");
         } else {
             m_widgets[w.type] += 1;
-            log("Added '" + w.type + "' widget #" + m_widgets[w.type] + "' to team '" + m_teamName + "'");
+            //log("Added '" + w.type + "' widget #" + m_widgets[w.type] + "' to team '" + m_teamName + "'");
         }
     }
 
-    that.widgetTypes = function() {
-        var keys = [];
-        for (var k in m_widgets) keys.push(k);
-        return keys.sort();
+    that.visitWidgets = function(callback) {
+        for (var type in m_widgets) {
+            var res = callback(type, m_widgets[type]);
+            if (res !== undefined)
+                return res;
+        }
+        return undefined;
     }
 
     that.widget = function(type) {