Browse Source

xhrupload: Start checking for progress timeouts on `loadstart`

Renée Kooi 7 years ago
parent
commit
74288b1328
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/plugins/XHRUpload.js

+ 7 - 1
src/plugins/XHRUpload.js

@@ -97,9 +97,15 @@ module.exports = class XHRUpload extends Plugin {
 
       const xhr = new XMLHttpRequest()
 
+      xhr.upload.addEventListener('loadstart', (ev) => {
+        if (opts.timeout > 0) {
+          // Begin checking for timeouts when loading starts.
+          isAlive()
+        }
+      })
+
       xhr.upload.addEventListener('progress', (ev) => {
         if (opts.timeout > 0) {
-          // Do connection timeout checks.
           isAlive()
         }