Mercurial > hg > rlgwebd
comparison rlgterm.js @ 38:b06a14876645
RLG-Web: reduce polling further.
The ajaxstate object now reduces polling to 15-second intervals and
stops entirely after one minute.
author | John "Elwin" Edwards <elwin@sdf.org> |
---|---|
date | Wed, 06 Jun 2012 10:53:29 -0700 |
parents | f15efa4818b4 |
children | e8ac0e3d2614 |
comparison
equal
deleted
inserted
replaced
37:353be34de307 | 38:b06a14876645 |
---|---|
21 gotnothing: function () { | 21 gotnothing: function () { |
22 if (this.state == 0) { | 22 if (this.state == 0) { |
23 this.set(1000); | 23 this.set(1000); |
24 this.state = 1; | 24 this.state = 1; |
25 } | 25 } |
26 else if (this.state < 4) { | |
27 this.set(4000); | |
28 this.state++; | |
29 } | |
30 else if (this.state < 8) { | |
31 this.set(15000); | |
32 this.state++; | |
33 } | |
26 else { | 34 else { |
27 this.set(4000); | 35 /* It's been over a minute. Stop polling. */ |
28 this.state = 2; | 36 this.clear(); |
29 } | 37 } |
30 }, | 38 }, |
31 posted: function (wasdata) { | 39 posted: function (wasdata) { |
32 if (wasdata) { | 40 if (wasdata) { |
33 this.set(1000); | 41 this.set(1000); |
409 } | 417 } |
410 | 418 |
411 function logout() { | 419 function logout() { |
412 if (termemu.sessid == null) | 420 if (termemu.sessid == null) |
413 return; | 421 return; |
422 /* TODO IFACE2 If the end was unexpected, tell player the game was saved. */ | |
414 termemu.sessid = null; | 423 termemu.sessid = null; |
424 ajaxstate.clear(); | |
415 setTitle("Game over."); | 425 setTitle("Game over."); |
416 nsend = 0; | 426 nsend = 0; |
417 nrecv = 0; | 427 nrecv = 0; |
418 msgQ = []; | 428 msgQ = []; |
419 //document.getElementById("loginform").style.display = "block"; | |
420 setmode("login"); | 429 setmode("login"); |
421 return; | 430 return; |
422 } | 431 } |
423 | 432 |
424 function stop() { | 433 function stop() { |