Browse Source

Emit progress 0, comments, FakeModal in DragDrop example

Artur Paikin 9 years ago
parent
commit
c8d0b60ea5
3 changed files with 14 additions and 3 deletions
  1. 4 2
      src/core/Core.js
  2. 6 0
      src/plugins/Tus10.js
  3. 4 1
      website/src/examples/dragdrop/app.es6

+ 4 - 2
src/core/Core.js

@@ -21,7 +21,7 @@ export default class Core {
     this.opts = Object.assign({}, defaultOptions, opts)
 
     // Dictates in what order different plugin types are ran:
-    this.types = [ 'presetter', 'progress', 'selecter', 'uploader' ]
+    this.types = [ 'presetter', 'view', 'progress', 'selecter', 'uploader' ]
 
     this.type = 'core'
 
@@ -103,7 +103,9 @@ export default class Core {
       method: 'run'
     })
 
-    // Forse `autoProceed` option to false if there are multiple selector Plugins active
+    // console.dir(this.plugins)
+
+    // Forse set `autoProceed` option to false if there are multiple selector Plugins active
     if (this.plugins.selecter && this.plugins.selecter.length > 1) {
       this.opts.autoProceed = false
     }

+ 6 - 0
src/plugins/Tus10.js

@@ -28,6 +28,12 @@ export default class Tus10 extends Plugin {
   upload (file, current, total) {
     console.log(`uploading ${current} of ${total}`)
 
+    // Dispatch progress 0 on start
+    this.core.emitter.emit('progress', {
+      plugin: this,
+      percentage: 0
+    })
+
     // Create a new tus upload
     const upload = new tus.Upload(file, {
       endpoint: this.opts.endpoint,

+ 4 - 1
website/src/examples/dragdrop/app.es6

@@ -5,13 +5,16 @@ import DragDrop from '../../../../src/plugins/DragDrop.js'
 import ProgressBar from '../../../../src/plugins/ProgressBar.js'
 import Spinner from '../../../../src/plugins/Spinner.js'
 import Tus10 from '../../../../src/plugins/Tus10.js'
+import FakeModal from '../../../../src/plugins/FakeModal.js'
 
 const uppyOne = new Uppy({debug: true})
 uppyOne
   .use(DragDrop, {target: '.UppyDragDrop-One'})
   .use(Tus10, {endpoint: 'http://master.tus.io:8080/files/'})
   .use(ProgressBar, {target: '.UppyDragDrop-One-Progress'})
-  .use(Spinner, {target: '.UppyDragDrop-One-Spinner'})
+  // .use(Spinner, {target: '.UppyDragDrop-One-Spinner'})
+  .use(Spinner, {target: FakeModal})
+  .use(FakeModal)
   .run()
 
 const uppyTwo = new Uppy({debug: true, autoProceed: false})