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.
This commit is contained in:
parent
dec7bc108a
commit
520226a343
1 changed files with 11 additions and 13 deletions
24
rlgterm.js
24
rlgterm.js
|
|
@ -15,31 +15,29 @@ 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;
|
||||
}
|
||||
},
|
||||
posted: function () {
|
||||
this.set(100);
|
||||
this.set(200);
|
||||
this.state = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function writeData(hexstr) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue