From 520226a3431f2b6a8ec97531c91f9b1831009280 Mon Sep 17 00:00:00 2001 From: "John \"Elwin\" Edwards" Date: Tue, 5 Jun 2012 22:33:41 -0700 Subject: [PATCH] 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. --- rlgterm.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/rlgterm.js b/rlgterm.js index ce703ba..48c207c 100644 --- a/rlgterm.js +++ b/rlgterm.js @@ -15,30 +15,28 @@ var ajaxstate = { 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; } };