# HG changeset patch # User John "Elwin" Edwards # Date 1338960821 25200 # Node ID f15efa4818b477f25bbe3f18ce0ddf906f930878 # Parent 57f4b36ef06b33d039d67e78f3a6f5faa14822dc 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. diff -r 57f4b36ef06b -r f15efa4818b4 rlgterm.js --- 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; } };