diff rlgterm.js @ 38:b06a14876645

RLG-Web: reduce polling further. The ajaxstate object now reduces polling to 15-second intervals and stops entirely after one minute.
author John "Elwin" Edwards <elwin@sdf.org>
date Wed, 06 Jun 2012 10:53:29 -0700
parents f15efa4818b4
children e8ac0e3d2614
line wrap: on
line diff
--- a/rlgterm.js	Wed Jun 06 10:08:31 2012 -0700
+++ b/rlgterm.js	Wed Jun 06 10:53:29 2012 -0700
@@ -23,9 +23,17 @@
       this.set(1000);
       this.state = 1;
     }
-    else {
+    else if (this.state < 4) {
       this.set(4000);
-      this.state = 2;
+      this.state++;
+    }
+    else if (this.state < 8) {
+      this.set(15000);
+      this.state++;
+    }
+    else {
+      /* It's been over a minute.  Stop polling. */
+      this.clear();
     }
   },
   posted: function (wasdata) {
@@ -411,12 +419,13 @@
 function logout() {
   if (termemu.sessid == null)
     return;
+  /* TODO IFACE2 If the end was unexpected, tell player the game was saved. */
   termemu.sessid = null;
+  ajaxstate.clear();
   setTitle("Game over.");
   nsend = 0;
   nrecv = 0;
   msgQ = [];
-  //document.getElementById("loginform").style.display = "block";
   setmode("login");
   return;
 }