summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-07-27 00:17:04 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-07-27 00:17:04 -0400
commitf1c7c475f6eab1a74dcf5b11aaeac9dd6ad986f8 (patch)
treed34f068e3d1ab9deb80f2c503ad646a30e151b47 /templates
parent1983ca2852461ca2082504dd22de07638030665b (diff)
automatically close the webapp window after 3 errors
It's unlikely an error would occur unless the server is stopped. But retrying a few times seems like a good idea anyway.
Diffstat (limited to 'templates')
-rw-r--r--templates/longpolling.julius12
1 files changed, 12 insertions, 0 deletions
diff --git a/templates/longpolling.julius b/templates/longpolling.julius
index 26356f5e9..351f2f8c6 100644
--- a/templates/longpolling.julius
+++ b/templates/longpolling.julius
@@ -7,6 +7,8 @@
(function( $ ) {
+numerrs=0;
+
$.LongPoll = (function() {
return {
send : function() {
@@ -16,6 +18,16 @@ $.LongPoll = (function() {
'success': function(data, status, jqxhr) {
$('##{poll}').replaceWith(data);
setTimeout($.LongPoll.send, #{delay});
+ numerrs=0;
+ },
+ 'error': function(jqxhr, msg, e) {
+ numerrs=numerrs+1;
+ if (numerrs > 3) {
+ window.close();
+ }
+ else {
+ setTimeout($.LongPoll.send, #{delay});
+ }
},
});
}