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.
This commit is contained in:
parent
1983ca2852
commit
f1c7c475f6
1 changed files with 12 additions and 0 deletions
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
(function( $ ) {
|
(function( $ ) {
|
||||||
|
|
||||||
|
numerrs=0;
|
||||||
|
|
||||||
$.LongPoll = (function() {
|
$.LongPoll = (function() {
|
||||||
return {
|
return {
|
||||||
send : function() {
|
send : function() {
|
||||||
|
@ -16,6 +18,16 @@ $.LongPoll = (function() {
|
||||||
'success': function(data, status, jqxhr) {
|
'success': function(data, status, jqxhr) {
|
||||||
$('##{poll}').replaceWith(data);
|
$('##{poll}').replaceWith(data);
|
||||||
setTimeout($.LongPoll.send, #{delay});
|
setTimeout($.LongPoll.send, #{delay});
|
||||||
|
numerrs=0;
|
||||||
|
},
|
||||||
|
'error': function(jqxhr, msg, e) {
|
||||||
|
numerrs=numerrs+1;
|
||||||
|
if (numerrs > 3) {
|
||||||
|
window.close();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setTimeout($.LongPoll.send, #{delay});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue