Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit 98586417f8c53eb03b36c618f74564fc6ca8081b 1 parent b654206
authored April 12, 2012

Showing 1 changed file with 8 additions and 1 deletion. Show diff stats Hide diff stats

  1. 9  Source/Mixin/Request.js
9  Source/Mixin/Request.js
@@ -80,10 +80,13 @@ LSD.Mixin.Request = new Class({
80 80
     var request = this[type == 'xhr' ? 'getXHRRequest' : 'getFormRequest'](options);
81 81
     request.addEvents({
82 82
       request: function() {
  83
+        clearTimeout(this.idling);
83 84
         this.busy()
84 85
       }.bind(this),
85 86
       complete: function() {
86  
-        this.idle();
  87
+        clearTimeout(this.idling);
  88
+        if (this.isRequestFinished()) this.idle();
  89
+        else this.idling = this.idle.delay(7500, this);
87 90
         if (request.isSuccess && request.isSuccess() && this.getCommandAction && this.getCommandAction() == 'submit')
88 91
           if (this.chainPhase == -1
89 92
           || (this.chainPhase == this.getActionChain().length - 1)
@@ -93,6 +96,10 @@ LSD.Mixin.Request = new Class({
93 96
     });
94 97
     return request;
95 98
   },
  99
+  
  100
+  isRequestFinished: function() {
  101
+    return !this.request.getHeader('X-Redirect');
  102
+  },
96 103
 
97 104
   getXHRRequest: function(options) {
98 105
     return new Request.Auto(options);

0 notes on commit 9858641

Please sign in to comment.
Something went wrong with that request. Please try again.