changeset 35:f15efa4818b4

rglterm.js: reduce the server polling. For roguelike games, most output will directly result from and follow immediately after input from the user. In other situations, data should not be expected.
author John "Elwin" Edwards <elwin@sdf.org>
date Tue, 05 Jun 2012 22:33:41 -0700
parents 57f4b36ef06b
children a0387f112bcf
files rlgterm.js
diffstat 1 files changed, 11 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/rlgterm.js	Tue Jun 05 20:13:47 2012 -0700
+++ b/rlgterm.js	Tue Jun 05 22:33:41 2012 -0700
@@ -15,30 +15,28 @@
     this.timerID = window.setTimeout(getData, ms);
   },
   gotdata: function () {
-    this.set(100);
-    this.state = 0;
+    this.set(1000);
+    this.state = 1;
   },
   gotnothing: function () {
     if (this.state == 0) {
-      this.set(100);
+      this.set(1000);
       this.state = 1;
     }
-    else if (this.state == 1) {
-      this.set(300);
+    else {
+      this.set(4000);
       this.state = 2;
     }
-    else if (this.state == 2) {
+  },
+  posted: function (wasdata) {
+    if (wasdata) {
       this.set(1000);
-      this.state = 3;
+      this.state = 1;
     }
     else {
-      this.set(5000);
-      this.state = 3;
+      this.set(200);
+      this.state = 0;
     }
-  },
-  posted: function () {
-    this.set(100);
-    this.state = 0;
   }
 };