diff rlgterm.js @ 63:a077f9f84052

RLG-Web client: adjust polling for watching. The ajaxterm state machine assumed data appears in response to user actions, which is not true when watching. It now uses different sets of parameters for playing and watching.
author John "Elwin" Edwards <elwin@sdf.org>
date Wed, 20 Jun 2012 07:41:59 -0700
parents 071ec6b1ec03
children e3082fd06520
line wrap: on
line diff
--- a/rlgterm.js	Wed Jun 20 07:37:15 2012 -0700
+++ b/rlgterm.js	Wed Jun 20 07:41:59 2012 -0700
@@ -27,13 +27,20 @@
       this.set(4000);
       this.state++;
     }
-    else if (this.state < 8) {
-      this.set(15000);
-      this.state++;
+    else if (session.playing) {
+      if (this.state < 8) {
+        this.set(15000);
+        this.state++;
+      }
+      else {
+        /* It's been over a minute.  Stop polling. */
+        this.clear();
+      }
     }
     else {
-      /* It's been over a minute.  Stop polling. */
-      this.clear();
+      /* If watching, it can't stop polling entirely, because there
+       * are no POST events to start it up again. */
+      this.set(10000);
     }
   },
   posted: function (wasdata) {