Only register each Sone once!
[Sone.git] / src / main / resources / templates / include / viewSone.html
index e054122..896f670 100644 (file)
                $("#sone .sone#" + soneId + " .last-update span.time").text(lastUpdated);
        }
 
+       registeredSones = {};
+
        $(document).ready(function() {
                $("#sone .sone").each(function() {
-                       getStatus($(this).attr("id"));
+                       soneId = $(this).attr("id");
+                       if (registeredSones[soneId]) {
+                               return;
+                       }
+                       registeredSones[soneId] = true;
+                       (function(soneId) {
+                               setTimeout(function() {
+                                       getStatus(soneId);
+                               }, 5000);
+                       })(soneId);
                });
        });
 </script>