From 94e9fa330c61ac6d4b792ee70c9fea82bd740997 Mon Sep 17 00:00:00 2001 From: "John \"Elwin\" Edwards" Date: Wed, 6 Jun 2012 10:53:29 -0700 Subject: [PATCH] RLG-Web: reduce polling further. The ajaxstate object now reduces polling to 15-second intervals and stops entirely after one minute. --- rlgterm.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/rlgterm.js b/rlgterm.js index 48c207c..754aebf 100644 --- a/rlgterm.js +++ b/rlgterm.js @@ -23,9 +23,17 @@ var ajaxstate = { 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 formreg(ev) { 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; }