Permalink
Browse files

Don't assign an idle state to widgets if there's a redirect coming up

  • Loading branch information...
1 parent b654206 commit 98586417f8c53eb03b36c618f74564fc6ca8081b @Inviz committed Apr 12, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 Source/Mixin/Request.js
View
@@ -80,10 +80,13 @@ LSD.Mixin.Request = new Class({
var request = this[type == 'xhr' ? 'getXHRRequest' : 'getFormRequest'](options);
request.addEvents({
request: function() {
+ clearTimeout(this.idling);
this.busy()
}.bind(this),
complete: function() {
- this.idle();
+ clearTimeout(this.idling);
+ if (this.isRequestFinished()) this.idle();
+ else this.idling = this.idle.delay(7500, this);
if (request.isSuccess && request.isSuccess() && this.getCommandAction && this.getCommandAction() == 'submit')
if (this.chainPhase == -1
|| (this.chainPhase == this.getActionChain().length - 1)
@@ -93,6 +96,10 @@ LSD.Mixin.Request = new Class({
});
return request;
},
+
+ isRequestFinished: function() {
+ return !this.request.getHeader('X-Redirect');
+ },
getXHRRequest: function(options) {
return new Request.Auto(options);

0 comments on commit 9858641

Please sign in to comment.