Commits

megamahi committed e231885

Moved the text setter call into it's own function so it's easily
callable.

  • Participants
  • Parent commits 750dd1c

Comments (0)

Files changed (1)

File tw2/dyntext/static/dyntext.js

-function setupPollingDynText(text_widget, data_url, interval)
-{
+function setDynamicText(text_widget, new_value) {
+    $("#"+text_widget).text(new_value);
+}
+
+function setupPollingDynText(text_widget, data_url, interval) {
     $.getJSON(data_url, function(data) {
-        var new_text = data.text;
-        
-        $("#"+text_widget).text(new_text);
+        setDynamicText(text_widget, data.text);
     });
 
     setTimeout( function () {