Procházet zdrojové kódy

xhrupload: Emit upload-started for "limited" files, fixes #468

Renée Kooi před 7 roky
rodič
revize
cdbb85400d
1 změnil soubory, kde provedl 4 přidání a 4 odebrání
  1. 4 4
      src/plugins/XHRUpload.js

+ 4 - 4
src/plugins/XHRUpload.js

@@ -199,16 +199,12 @@ module.exports = class XHRUpload extends Plugin {
         // if (!files[file.id]) return
         xhr.abort()
       })
-
-      this.uppy.emit('upload-started', file.id)
     })
   }
 
   uploadRemote (file, current, total) {
     const opts = this.getOptions(file)
     return new Promise((resolve, reject) => {
-      this.uppy.emit('upload-started', file.id)
-
       const fields = {}
       const metaFields = Array.isArray(opts.metaFields)
         ? opts.metaFields
@@ -269,8 +265,12 @@ module.exports = class XHRUpload extends Plugin {
       if (file.error) {
         return () => Promise.reject(new Error(file.error))
       } else if (file.isRemote) {
+        // We emit upload-started here, so that it's also emitted for files
+        // that have to wait due to the `limit` option.
+        this.uppy.emit('upload-started', file.id)
         return this.uploadRemote.bind(this, file, current, total)
       } else {
+        this.uppy.emit('upload-started', file.id)
         return this.upload.bind(this, file, current, total)
       }
     })