Remove lumped team.widgetTypes method with more functional visitWidgets.
authorMike Taylor <mike@indexdata.com>
Thu, 1 May 2014 13:08:24 +0000 (14:08 +0100)
committerMike Taylor <mike@indexdata.com>
Thu, 1 May 2014 13:08:24 +0000 (14:08 +0100)
src/mkws-team.js

index ab53e94..c6c5490 100644 (file)
@@ -440,10 +440,13 @@ function team($, 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) {