Browse Source

core: Remove .run().

Renée Kooi 7 years ago
parent
commit
37768e1531

+ 1 - 1
CHANGELOG.md

@@ -117,7 +117,7 @@ What we need to do to release Uppy 1.0
 - [ ] core: look into utilizing https://github.com/que-etc/resize-observer-polyfill for responsive components. See also https://github.com/transloadit/uppy/issues/750
 - [ ] core: look into utilizing https://github.com/que-etc/resize-observer-polyfill for responsive components. See also https://github.com/transloadit/uppy/issues/750
 - [x] statusbar: add some spacing between text elements (#760 / @goto-bus-stop)
 - [x] statusbar: add some spacing between text elements (#760 / @goto-bus-stop)
 - [ ] docs: improve on React docs https://uppy.io/docs/react/, add small example for each component maybe? Dashboard, DragDrop, ProgressBar? No need to make separate pages for all of them, just headings on the same page. Right now docs are confusing, because they focus on DashboardModal. Also problems with syntax highlight on https://uppy.io/docs/react/dashboard-modal/.
 - [ ] docs: improve on React docs https://uppy.io/docs/react/, add small example for each component maybe? Dashboard, DragDrop, ProgressBar? No need to make separate pages for all of them, just headings on the same page. Right now docs are confusing, because they focus on DashboardModal. Also problems with syntax highlight on https://uppy.io/docs/react/dashboard-modal/.
-- [ ] docs: add note in docs or solve the .run() issue, see #756
+- [x] docs: add note in docs or solve the .run() issue, see #756
 - [x] core: add `uppy.getFiles()` method (@goto-bus-stop / #770)
 - [x] core: add `uppy.getFiles()` method (@goto-bus-stop / #770)
 - [x] dashboard: fix duplicate plugin IDs, see #702 (@goto-bus-stop)
 - [x] dashboard: fix duplicate plugin IDs, see #702 (@goto-bus-stop)
 - [x] react: update propTypes (#776 / @goto-bus-stop)
 - [x] react: update propTypes (#776 / @goto-bus-stop)

+ 4 - 6
README.md

@@ -35,7 +35,6 @@ const uppy = Uppy({ autoProceed: false })
   .use(Instagram, { target: Dashboard, host: 'https://server.uppy.io' })
   .use(Instagram, { target: Dashboard, host: 'https://server.uppy.io' })
   .use(Webcam, { target: Dashboard })
   .use(Webcam, { target: Dashboard })
   .use(Tus, { endpoint: 'https://master.tus.io/files/' })
   .use(Tus, { endpoint: 'https://master.tus.io/files/' })
-  .run()
   .on('complete', (result) => {
   .on('complete', (result) => {
     console.log('Upload result:', result)
     console.log('Upload result:', result)
   })
   })
@@ -89,7 +88,6 @@ Alternatively, you can also use a pre-built bundle from Transloadit's CDN: Edgly
   var uppy = Uppy.Core()
   var uppy = Uppy.Core()
   uppy.use(Uppy.DragDrop, { target: '.UppyDragDrop' })
   uppy.use(Uppy.DragDrop, { target: '.UppyDragDrop' })
   uppy.use(Uppy.Tus, { endpoint: '//master.tus.io/files/' })
   uppy.use(Uppy.Tus, { endpoint: '//master.tus.io/files/' })
-  uppy.run()
 </script>
 </script>
 ```
 ```
 
 
@@ -135,8 +133,8 @@ We aim to support IE10+ and recent versions of Safari, Edge, Chrome, Firefox, an
 Having no JavaScript beats having a lot of it, so that’s a fair question! Running an uploading & encoding business for ten years though we found that in cases, the file input leaves some to be desired:
 Having no JavaScript beats having a lot of it, so that’s a fair question! Running an uploading & encoding business for ten years though we found that in cases, the file input leaves some to be desired:
 
 
 - We received complaints about broken uploads and found that resumable uploads are important, especially for big files and to be inclusive towards people on poorer connections (we also launched [tus.io](https://tus.io) to attack that problem). Uppy uploads can survive network outages and browser crashes or accidental navigate-aways.
 - We received complaints about broken uploads and found that resumable uploads are important, especially for big files and to be inclusive towards people on poorer connections (we also launched [tus.io](https://tus.io) to attack that problem). Uppy uploads can survive network outages and browser crashes or accidental navigate-aways.
-- Uppy supports editing meta information before uploading (and e.g. cropping is planned). 
-- There’s the situation where people are using their mobile devices and want to upload on the go, but they have their picture on Instagram, files in Dropbox, or just a plain file url from anywhere on the open web. Uppy allows to pick files from those and push it to the destination without downloading it to your mobile device first. 
+- Uppy supports editing meta information before uploading (and e.g. cropping is planned).
+- There’s the situation where people are using their mobile devices and want to upload on the go, but they have their picture on Instagram, files in Dropbox, or just a plain file url from anywhere on the open web. Uppy allows to pick files from those and push it to the destination without downloading it to your mobile device first.
 - Accurate upload progress reporting is an issue on many platforms.
 - Accurate upload progress reporting is an issue on many platforms.
 - Some file validation — size, type, number of files — can be done on the client with Uppy.
 - Some file validation — size, type, number of files — can be done on the client with Uppy.
 - Uppy integrates webcam support, in case your users want to upload a picture/video/audio that does not exist yet :)
 - Uppy integrates webcam support, in case your users want to upload a picture/video/audio that does not exist yet :)
@@ -148,7 +146,7 @@ Not all apps need all of these features. A `<input type="file">` is fine in many
 
 
 ### Why is all this goodness free?
 ### Why is all this goodness free?
 
 
-Transloadit’s team is small and we have a shared ambition to make a living from open source. By giving away projects like [tus.io](https://tus.io) and [Uppy](https://uppy.io),we’re hoping to advance the state of the art, make life a tiny little bit better for everyone, and in doing so have rewarding jobs and get some eyes on our commercial service: [a content ingestion & processing platform](https://transloadit.com). 
+Transloadit’s team is small and we have a shared ambition to make a living from open source. By giving away projects like [tus.io](https://tus.io) and [Uppy](https://uppy.io),we’re hoping to advance the state of the art, make life a tiny little bit better for everyone, and in doing so have rewarding jobs and get some eyes on our commercial service: [a content ingestion & processing platform](https://transloadit.com).
 
 
 Our thinking is that if just a fraction of our open source userbase can see the appeal of hosted versions straight from the source, that could already be enough to sustain our work. So far this is working out! We’re able to dedicate 80% of our time to open source and haven’t gone bankrupt just yet :D
 Our thinking is that if just a fraction of our open source userbase can see the appeal of hosted versions straight from the source, that could already be enough to sustain our work. So far this is working out! We’re able to dedicate 80% of our time to open source and haven’t gone bankrupt just yet :D
 
 
@@ -162,7 +160,7 @@ Yes, there is an S3 plugin, please check out the [docs](https://uppy.io/docs/aws
 
 
 ### Do I need to install special service/server for Uppy? Can I use it with Rails/Node/Go/PHP?
 ### Do I need to install special service/server for Uppy? Can I use it with Rails/Node/Go/PHP?
 
 
-Yes, whatever you want on the backend will work with `XHRUpload` plugin, since it just does a `POST` or `PUT` request. Here’s a [PHP backend example](https://uppy.io/docs/xhrupload/#Uploading-to-a-PHP-Server). 
+Yes, whatever you want on the backend will work with `XHRUpload` plugin, since it just does a `POST` or `PUT` request. Here’s a [PHP backend example](https://uppy.io/docs/xhrupload/#Uploading-to-a-PHP-Server).
 
 
 If you want resumability with the Tus plugin, use [one of the tus server implementations](https://tus.io/implementations.html) 👌🏼
 If you want resumability with the Tus plugin, use [one of the tus server implementations](https://tus.io/implementations.html) 👌🏼
 
 

+ 0 - 2
examples/aws-presigned-url/main.js

@@ -38,5 +38,3 @@ uppy.use(AwsS3, {
     })
     })
   }
   }
 })
 })
-
-uppy.run()

+ 0 - 2
examples/aws-uppy-server/main.js

@@ -21,5 +21,3 @@ uppy.use(Dashboard, {
 uppy.use(AwsS3, {
 uppy.use(AwsS3, {
   host: 'http://localhost:3020'
   host: 'http://localhost:3020'
 })
 })
-
-uppy.run()

+ 0 - 1
examples/bundled-example/main.js

@@ -34,7 +34,6 @@ const uppy = Uppy({
   .use(Tus, { endpoint: TUS_ENDPOINT })
   .use(Tus, { endpoint: TUS_ENDPOINT })
   .use(Form, { target: '#upload-form' })
   .use(Form, { target: '#upload-form' })
   // .use(GoldenRetriever, {serviceWorker: true})
   // .use(GoldenRetriever, {serviceWorker: true})
-  .run()
 
 
 uppy.on('complete', (result) => {
 uppy.on('complete', (result) => {
   if (result.failed.length === 0) {
   if (result.failed.length === 0) {

+ 0 - 1
examples/cdn-example/index.html

@@ -14,7 +14,6 @@
         .use(Uppy.Dashboard, { trigger: '#uppyModalOpener' })
         .use(Uppy.Dashboard, { trigger: '#uppyModalOpener' })
         .use(Uppy.Webcam, {target: Uppy.Dashboard})
         .use(Uppy.Webcam, {target: Uppy.Dashboard})
         .use(Uppy.Tus, { endpoint: 'https://master.tus.io/files/' })
         .use(Uppy.Tus, { endpoint: 'https://master.tus.io/files/' })
-        .run()
 
 
       uppy.on('success', (fileCount) => {
       uppy.on('success', (fileCount) => {
         console.log(`${fileCount} files uploaded`)
         console.log(`${fileCount} files uploaded`)

+ 0 - 1
examples/custom-provider/client/main.js

@@ -24,4 +24,3 @@ uppy.use(Dashboard, {
 })
 })
 
 
 uppy.use(Tus, {endpoint: 'https://master.tus.io/files/'})
 uppy.use(Tus, {endpoint: 'https://master.tus.io/files/'})
-uppy.run()

+ 0 - 2
examples/digitalocean-spaces/main.js

@@ -14,5 +14,3 @@ uppy.use(Dashboard, {
 
 
 // No client side changes needed!
 // No client side changes needed!
 uppy.use(AwsS3, { host: '/uppy-server' })
 uppy.use(AwsS3, { host: '/uppy-server' })
-
-uppy.run()

+ 0 - 2
examples/multiple-instances/main.js

@@ -14,7 +14,6 @@ const a = Uppy({
     width: 400
     width: 400
   })
   })
   .use(GoldenRetriever, { serviceWorker: false })
   .use(GoldenRetriever, { serviceWorker: false })
-  .run()
 
 
 const b = Uppy({
 const b = Uppy({
   id: 'b',
   id: 'b',
@@ -26,7 +25,6 @@ const b = Uppy({
     width: 400
     width: 400
   })
   })
   .use(GoldenRetriever, { serviceWorker: false })
   .use(GoldenRetriever, { serviceWorker: false })
-  .run()
 
 
 window.a = a
 window.a = a
 window.b = b
 window.b = b

+ 0 - 2
examples/react-example/App.js

@@ -21,11 +21,9 @@ module.exports = class App extends React.Component {
     this.uppy = new Uppy({ autoProceed: false })
     this.uppy = new Uppy({ autoProceed: false })
       .use(Tus, { endpoint: 'https://master.tus.io/files/' })
       .use(Tus, { endpoint: 'https://master.tus.io/files/' })
       .use(GoogleDrive, { host: 'https://server.uppy.io' })
       .use(GoogleDrive, { host: 'https://server.uppy.io' })
-      .run()
 
 
     this.uppy2 = new Uppy({ autoProceed: false })
     this.uppy2 = new Uppy({ autoProceed: false })
       .use(Tus, { endpoint: 'https://master.tus.io/files/' })
       .use(Tus, { endpoint: 'https://master.tus.io/files/' })
-      .run()
   }
   }
 
 
   componentWillUnmount () {
   componentWillUnmount () {

+ 0 - 1
examples/redux/main.js

@@ -79,6 +79,5 @@ uppy.use(Dashboard, {
   width: 400
   width: 400
 })
 })
 uppy.use(Tus, { endpoint: 'https://master.tus.io/' })
 uppy.use(Tus, { endpoint: 'https://master.tus.io/' })
-uppy.run()
 
 
 window.uppy = uppy
 window.uppy = uppy

+ 0 - 1
examples/uppy-with-server/client/index.html

@@ -15,7 +15,6 @@
         .use(Uppy.Instagram, { target: Uppy.Dashboard, host: 'http://localhost:3020' })
         .use(Uppy.Instagram, { target: Uppy.Dashboard, host: 'http://localhost:3020' })
         .use(Uppy.GoogleDrive, { target: Uppy.Dashboard, host: 'http://localhost:3020' })
         .use(Uppy.GoogleDrive, { target: Uppy.Dashboard, host: 'http://localhost:3020' })
         .use(Uppy.Tus, { endpoint: 'https://master.tus.io/files/' })
         .use(Uppy.Tus, { endpoint: 'https://master.tus.io/files/' })
-        .run()
 
 
       uppy.on('success', (fileCount) => {
       uppy.on('success', (fileCount) => {
         console.log(`${fileCount} files uploaded`)
         console.log(`${fileCount} files uploaded`)

+ 0 - 2
examples/xhr-bundle/main.js

@@ -17,5 +17,3 @@ uppy.use(XHRUpload, {
   endpoint: 'http://localhost:9967/upload',
   endpoint: 'http://localhost:9967/upload',
   fieldName: 'files'
   fieldName: 'files'
 })
 })
-
-uppy.run()

+ 5 - 18
src/core/Core.js

@@ -128,6 +128,8 @@ class Uppy {
       window['uppyLog'] = ''
       window['uppyLog'] = ''
       window[this.opts.id] = this
       window[this.opts.id] = this
     }
     }
+
+    this._addListeners()
   }
   }
 
 
   on (event, callback) {
   on (event, callback) {
@@ -631,20 +633,8 @@ class Uppy {
   /**
   /**
    * Registers listeners for all global actions, like:
    * Registers listeners for all global actions, like:
    * `error`, `file-removed`, `upload-progress`
    * `error`, `file-removed`, `upload-progress`
-   *
    */
    */
-  actions () {
-    // const log = this.log
-    // this.on('*', function (payload) {
-    //   log(`[Core] Event: ${this.event}`)
-    //   log(payload)
-    // })
-
-    // stress-test re-rendering
-    // setInterval(() => {
-    //   this.setState({bla: 'bla'})
-    // }, 20)
-
+  _addListeners () {
     this.on('error', (error) => {
     this.on('error', (error) => {
       this.setState({ error: error.message })
       this.setState({ error: error.message })
     })
     })
@@ -972,13 +962,10 @@ class Uppy {
   }
   }
 
 
   /**
   /**
-   * Initializes actions.
-   *
+   * Obsolete, event listeners are now added in the constructor.
    */
    */
   run () {
   run () {
-    this.log('Core is run, initializing actions...')
-    this.actions()
-
+    this.log('Calling run() is no longer necessary.', 'warning')
     return this
     return this
   }
   }
 
 

+ 3 - 19
src/core/Core.test.js

@@ -298,7 +298,6 @@ describe('src/Core', () => {
       core.addUploader((fileIDs, uploadID) => {
       core.addUploader((fileIDs, uploadID) => {
         core.addResultData(uploadID, { upload: 'ok' })
         core.addResultData(uploadID, { upload: 'ok' })
       })
       })
-      core.run()
       return core.upload().then((result) => {
       return core.upload().then((result) => {
         expect(result.pre).toBe('ok')
         expect(result.pre).toBe('ok')
         expect(result.upload).toBe('ok')
         expect(result.upload).toBe('ok')
@@ -357,7 +356,6 @@ describe('src/Core', () => {
 
 
     it('should update the file progress state when preprocess-progress event is fired', () => {
     it('should update the file progress state when preprocess-progress event is fired', () => {
       const core = new Core()
       const core = new Core()
-      core.run()
       core.addFile({
       core.addFile({
         source: 'jest',
         source: 'jest',
         name: 'foo.jpg',
         name: 'foo.jpg',
@@ -384,7 +382,6 @@ describe('src/Core', () => {
 
 
     it('should update the file progress state when preprocess-complete event is fired', () => {
     it('should update the file progress state when preprocess-complete event is fired', () => {
       const core = new Core()
       const core = new Core()
-      core.run()
 
 
       core.addFile({
       core.addFile({
         source: 'jest',
         source: 'jest',
@@ -465,7 +462,6 @@ describe('src/Core', () => {
 
 
     it('should update the file progress state when postprocess-progress event is fired', () => {
     it('should update the file progress state when postprocess-progress event is fired', () => {
       const core = new Core()
       const core = new Core()
-      core.run()
 
 
       core.addFile({
       core.addFile({
         source: 'jest',
         source: 'jest',
@@ -493,7 +489,6 @@ describe('src/Core', () => {
 
 
     it('should update the file progress state when postprocess-complete event is fired', () => {
     it('should update the file progress state when postprocess-complete event is fired', () => {
       const core = new Core()
       const core = new Core()
-      core.run()
 
 
       core.addFile({
       core.addFile({
         source: 'jest',
         source: 'jest',
@@ -564,7 +559,6 @@ describe('src/Core', () => {
       const fileData = new File([sampleImage], { type: 'image/jpeg' })
       const fileData = new File([sampleImage], { type: 'image/jpeg' })
       const fileAddedEventMock = jest.fn()
       const fileAddedEventMock = jest.fn()
       const core = new Core()
       const core = new Core()
-      core.run()
       core.on('file-added', fileAddedEventMock)
       core.on('file-added', fileAddedEventMock)
 
 
       core.addFile({
       core.addFile({
@@ -638,7 +632,7 @@ describe('src/Core', () => {
 
 
   describe('uploading a file', () => {
   describe('uploading a file', () => {
     it('should return a { successful, failed } pair containing file objects', () => {
     it('should return a { successful, failed } pair containing file objects', () => {
-      const core = new Core().run()
+      const core = new Core()
       core.addUploader((fileIDs) => Promise.resolve())
       core.addUploader((fileIDs) => Promise.resolve())
 
 
       core.addFile({ source: 'jest', name: 'foo.jpg', type: 'image/jpeg', data: new Uint8Array() })
       core.addFile({ source: 'jest', name: 'foo.jpg', type: 'image/jpeg', data: new Uint8Array() })
@@ -654,7 +648,7 @@ describe('src/Core', () => {
     })
     })
 
 
     it('should return files with errors in the { failed } key', () => {
     it('should return files with errors in the { failed } key', () => {
-      const core = new Core().run()
+      const core = new Core()
       core.addUploader((fileIDs) => {
       core.addUploader((fileIDs) => {
         fileIDs.forEach((fileID) => {
         fileIDs.forEach((fileID) => {
           const file = core.getFile(fileID)
           const file = core.getFile(fileID)
@@ -679,7 +673,7 @@ describe('src/Core', () => {
     })
     })
 
 
     it('should only upload files that are not already assigned to another upload id', () => {
     it('should only upload files that are not already assigned to another upload id', () => {
-      const core = new Core().run()
+      const core = new Core()
       core.store.state.currentUploads = {
       core.store.state.currentUploads = {
         upload1: {
         upload1: {
           fileIDs: ['uppy-file1jpg-image/jpeg', 'uppy-file2jpg-image/jpeg', 'uppy-file3jpg-image/jpeg']
           fileIDs: ['uppy-file1jpg-image/jpeg', 'uppy-file2jpg-image/jpeg', 'uppy-file3jpg-image/jpeg']
@@ -738,7 +732,6 @@ describe('src/Core', () => {
 
 
       const core = new Core()
       const core = new Core()
       core.on('file-removed', fileRemovedEventMock)
       core.on('file-removed', fileRemovedEventMock)
-      core.run()
 
 
       core.addFile({
       core.addFile({
         source: 'jest',
         source: 'jest',
@@ -930,7 +923,6 @@ describe('src/Core', () => {
     it('should reset the progress', () => {
     it('should reset the progress', () => {
       const resetProgressEvent = jest.fn()
       const resetProgressEvent = jest.fn()
       const core = new Core()
       const core = new Core()
-      core.run()
       core.on('reset-progress', resetProgressEvent)
       core.on('reset-progress', resetProgressEvent)
 
 
       core.addFile({
       core.addFile({
@@ -1068,14 +1060,12 @@ describe('src/Core', () => {
   describe('actions', () => {
   describe('actions', () => {
     it('should update the state when receiving the error event', () => {
     it('should update the state when receiving the error event', () => {
       const core = new Core()
       const core = new Core()
-      core.run()
       core.emit('error', new Error('foooooo'))
       core.emit('error', new Error('foooooo'))
       expect(core.state.error).toEqual('foooooo')
       expect(core.state.error).toEqual('foooooo')
     })
     })
 
 
     it('should update the state when receiving the upload-error event', () => {
     it('should update the state when receiving the upload-error event', () => {
       const core = new Core()
       const core = new Core()
-      core.run()
       core.state.files['fileId'] = {
       core.state.files['fileId'] = {
         name: 'filename'
         name: 'filename'
       }
       }
@@ -1085,7 +1075,6 @@ describe('src/Core', () => {
 
 
     it('should reset the error state when receiving the upload event', () => {
     it('should reset the error state when receiving the upload event', () => {
       const core = new Core()
       const core = new Core()
-      core.run()
       core.emit('error', { foo: 'bar' })
       core.emit('error', { foo: 'bar' })
       core.emit('upload')
       core.emit('upload')
       expect(core.state.error).toEqual(null)
       expect(core.state.error).toEqual(null)
@@ -1143,7 +1132,6 @@ describe('src/Core', () => {
     it('should set a string based message to be displayed infinitely', () => {
     it('should set a string based message to be displayed infinitely', () => {
       const infoVisibleEvent = jest.fn()
       const infoVisibleEvent = jest.fn()
       const core = new Core()
       const core = new Core()
-      core.run()
       core.on('info-visible', infoVisibleEvent)
       core.on('info-visible', infoVisibleEvent)
 
 
       core.info('This is the message', 'info', 0)
       core.info('This is the message', 'info', 0)
@@ -1160,7 +1148,6 @@ describe('src/Core', () => {
     it('should set a object based message to be displayed infinitely', () => {
     it('should set a object based message to be displayed infinitely', () => {
       const infoVisibleEvent = jest.fn()
       const infoVisibleEvent = jest.fn()
       const core = new Core()
       const core = new Core()
-      core.run()
       core.on('info-visible', infoVisibleEvent)
       core.on('info-visible', infoVisibleEvent)
 
 
       core.info({
       core.info({
@@ -1185,7 +1172,6 @@ describe('src/Core', () => {
       const infoVisibleEvent = jest.fn()
       const infoVisibleEvent = jest.fn()
       const infoHiddenEvent = jest.fn()
       const infoHiddenEvent = jest.fn()
       const core = new Core()
       const core = new Core()
-      core.run()
       core.on('info-visible', infoVisibleEvent)
       core.on('info-visible', infoVisibleEvent)
       core.on('info-hidden', infoHiddenEvent)
       core.on('info-hidden', infoHiddenEvent)
 
 
@@ -1208,7 +1194,6 @@ describe('src/Core', () => {
       const infoVisibleEvent = jest.fn()
       const infoVisibleEvent = jest.fn()
       const infoHiddenEvent = jest.fn()
       const infoHiddenEvent = jest.fn()
       const core = new Core()
       const core = new Core()
-      core.run()
       core.on('info-visible', infoVisibleEvent)
       core.on('info-visible', infoVisibleEvent)
       core.on('info-hidden', infoHiddenEvent)
       core.on('info-hidden', infoHiddenEvent)
 
 
@@ -1229,7 +1214,6 @@ describe('src/Core', () => {
   describe('createUpload', () => {
   describe('createUpload', () => {
     it('should assign the specified files to a new upload', () => {
     it('should assign the specified files to a new upload', () => {
       const core = new Core()
       const core = new Core()
-      core.run()
       core.addFile({
       core.addFile({
         source: 'jest',
         source: 'jest',
         name: 'foo.jpg',
         name: 'foo.jpg',

+ 0 - 1
src/plugins/Transloadit/index.test.js

@@ -147,7 +147,6 @@ describe('Transloadit', () => {
         throw new Error('should not create Assembly')
         throw new Error('should not create Assembly')
       }
       }
     })
     })
-    uppy.run()
 
 
     return uppy.upload()
     return uppy.upload()
   })
   })

+ 0 - 4
test/endtoend/src/main.js

@@ -15,7 +15,6 @@ const uppyDragDrop = Uppy({
   })
   })
   .use(ProgressBar, { target: '#uppyDragDrop-progress' })
   .use(ProgressBar, { target: '#uppyDragDrop-progress' })
   .use(Tus, { endpoint: 'https://master.tus.io/files/' })
   .use(Tus, { endpoint: 'https://master.tus.io/files/' })
-  .run()
 
 
 const uppyi18n = Uppy({
 const uppyi18n = Uppy({
   id: 'uppyi18n',
   id: 'uppyi18n',
@@ -32,7 +31,6 @@ const uppyi18n = Uppy({
   })
   })
   .use(ProgressBar, { target: '#uppyi18n-progress' })
   .use(ProgressBar, { target: '#uppyi18n-progress' })
   .use(XHRUpload, { endpoint: 'https://api2.transloadit.com' })
   .use(XHRUpload, { endpoint: 'https://api2.transloadit.com' })
-  .run()
 
 
 const uppyDashboard = Uppy({
 const uppyDashboard = Uppy({
   id: 'uppyDashboard',
   id: 'uppyDashboard',
@@ -43,7 +41,6 @@ const uppyDashboard = Uppy({
     inline: true
     inline: true
   })
   })
   .use(Tus, { endpoint: 'https://master.tus.io/files/' })
   .use(Tus, { endpoint: 'https://master.tus.io/files/' })
-  .run()
 
 
 function startXHRLimitTest (endpoint) {
 function startXHRLimitTest (endpoint) {
   const uppy = Uppy({
   const uppy = Uppy({
@@ -53,7 +50,6 @@ function startXHRLimitTest (endpoint) {
   })
   })
     .use(DragDrop, { target: '#uppyXhrLimit' })
     .use(DragDrop, { target: '#uppyXhrLimit' })
     .use(XHRUpload, { endpoint, limit: 2 })
     .use(XHRUpload, { endpoint, limit: 2 })
-    .run()
 
 
   uppy.uploadsStarted = 0
   uppy.uploadsStarted = 0
   uppy.uploadsComplete = 0
   uppy.uploadsComplete = 0

+ 1 - 2
website/src/api-usage-example.ejs

@@ -5,7 +5,6 @@ import Tus from 'uppy/lib/plugins/Tus'
 Uppy({ autoProceed: false })
 Uppy({ autoProceed: false })
   .use(Dashboard, { trigger: '#select-files' })
   .use(Dashboard, { trigger: '#select-files' })
   .use(Tus, { endpoint: 'https://master.tus.io/files/' })
   .use(Tus, { endpoint: 'https://master.tus.io/files/' })
-  .run()
   .on('complete', (result) => {
   .on('complete', (result) => {
     console.log('Upload result:', result)
     console.log('Upload result:', result)
-  })
+  })

+ 0 - 1
website/src/docs/golden-retriever.md

@@ -22,7 +22,6 @@ require('uppy/lib/plugins/GoldenRetriever/ServiceWorker.js')
 const GoldenRetriever = require('uppy/lib/plugins/GoldenRetriever')
 const GoldenRetriever = require('uppy/lib/plugins/GoldenRetriever')
 
 
 uppy.use(GoldenRetriever, {serviceWorker: true})
 uppy.use(GoldenRetriever, {serviceWorker: true})
-uppy.run()
 
 
 if ('serviceWorker' in navigator) {
 if ('serviceWorker' in navigator) {
   navigator.serviceWorker
   navigator.serviceWorker

+ 0 - 2
website/src/docs/index.md

@@ -20,7 +20,6 @@ const uppy = Uppy({ autoProceed: false })
     trigger: '#select-files'
     trigger: '#select-files'
   })
   })
   .use(Tus, {endpoint: 'https://master.tus.io/files/'})
   .use(Tus, {endpoint: 'https://master.tus.io/files/'})
-  .run()
  
  
 uppy.on('complete', (result) => {
 uppy.on('complete', (result) => {
   console.log(`Upload complete! We’ve uploaded these files: ${result.successful}`)
   console.log(`Upload complete! We’ve uploaded these files: ${result.successful}`)
@@ -63,7 +62,6 @@ Alternatively, you can also use a pre-built bundle from Transloadit's CDN: Edgly
   var uppy = Uppy.Core({ autoProceed: false })
   var uppy = Uppy.Core({ autoProceed: false })
   uppy.use(Uppy.DragDrop, { target: '#drag-drop-area' })
   uppy.use(Uppy.DragDrop, { target: '#drag-drop-area' })
   uppy.use(Uppy.Tus, { endpoint: 'https://master.tus.io/files/' })
   uppy.use(Uppy.Tus, { endpoint: 'https://master.tus.io/files/' })
-  uppy.run()
 </script>
 </script>
 ```
 ```
 
 

+ 0 - 2
website/src/docs/react.md

@@ -35,8 +35,6 @@ uppy.on('complete', (result) => {
   })
   })
 })
 })
 
 
-uppy.run()
-
 const AvatarPicker = ({ currentAvatar }) => {
 const AvatarPicker = ({ currentAvatar }) => {
   return (
   return (
     <div>
     <div>

+ 3 - 3
website/src/docs/redux.md

@@ -41,10 +41,10 @@ const uppy = Uppy({
   meta: {
   meta: {
     username: 'John',
     username: 'John',
     license: 'Creative Commons'
     license: 'Creative Commons'
+  }
 })
 })
-.use(XHRUpload, { endpoint: 'https://example.com' })
-.use(ReduxDevTools)
-.run()
+  .use(XHRUpload, { endpoint: 'https://example.com' })
+  .use(ReduxDevTools)
 ```
 ```
 
 
 After you `.use(ReduxDevTools)`, you should be able to see Uppy’s state in Redux Dev Tools.
 After you `.use(ReduxDevTools)`, you should be able to see Uppy’s state in Redux Dev Tools.

+ 0 - 4
website/src/docs/uppy.md

@@ -212,10 +212,6 @@ const uppy = Uppy()
 uppy.use(DragDrop, { target: 'body' })
 uppy.use(DragDrop, { target: 'body' })
 ```
 ```
 
 
-### `uppy.run()`
-
-Initializes everything after setup. Must be called before calling `.upload()` or using Uppy in any meaningful way.
-
 ### `uppy.getID()`
 ### `uppy.getID()`
 
 
 Get the uppy instance ID, see the [`id` option](#id-39-uppy-39).
 Get the uppy instance ID, see the [`id` option](#id-39-uppy-39).

+ 0 - 1
website/src/examples/bundle/app.html

@@ -8,7 +8,6 @@
   uppy.use(Uppy.Tus, {endpoint: '//master.tus.io/files/'});
   uppy.use(Uppy.Tus, {endpoint: '//master.tus.io/files/'});
   uppy.use(Uppy.DragDrop, {target: '#uppy-dnd'});
   uppy.use(Uppy.DragDrop, {target: '#uppy-dnd'});
   uppy.use(Uppy.ProgressBar);
   uppy.use(Uppy.ProgressBar);
-  uppy.run();
 
 
   console.log('Uppy loaded from CDN with tus enabled');
   console.log('Uppy loaded from CDN with tus enabled');
 </script>
 </script>

+ 0 - 1
website/src/examples/dashboard/app.es6

@@ -69,7 +69,6 @@ function uppyInit () {
   }
   }
 
 
   uppy.use(Tus, { endpoint: 'https://master.tus.io/files/', resume: true })
   uppy.use(Tus, { endpoint: 'https://master.tus.io/files/', resume: true })
-  uppy.run()
 
 
   uppy.on('complete', result => {
   uppy.on('complete', result => {
     console.log('successful files:')
     console.log('successful files:')

+ 0 - 1
website/src/examples/dashboard/index.ejs

@@ -55,7 +55,6 @@ const uppy = Uppy({
 .use(Instagram, { target: Dashboard, host: 'https://server.uppy.io' })
 .use(Instagram, { target: Dashboard, host: 'https://server.uppy.io' })
 .use(Webcam, { target: Dashboard })
 .use(Webcam, { target: Dashboard })
 .use(Tus, { endpoint: 'https://master.tus.io/files/' })
 .use(Tus, { endpoint: 'https://master.tus.io/files/' })
-.run()
 
 
 uppy.on('complete', result => {
 uppy.on('complete', result => {
   console.log('successful files:', result.successful)
   console.log('successful files:', result.successful)

+ 0 - 2
website/src/examples/dragdrop/app.es6

@@ -8,14 +8,12 @@ uppyOne
   .use(DragDrop, {target: '.UppyDragDrop-One'})
   .use(DragDrop, {target: '.UppyDragDrop-One'})
   .use(Tus, {endpoint: '//master.tus.io/files/'})
   .use(Tus, {endpoint: '//master.tus.io/files/'})
   .use(ProgressBar, {target: '.UppyDragDrop-One-Progress', hideAfterFinish: false})
   .use(ProgressBar, {target: '.UppyDragDrop-One-Progress', hideAfterFinish: false})
-  .run()
 
 
 const uppyTwo = new Uppy({debug: true, autoProceed: false})
 const uppyTwo = new Uppy({debug: true, autoProceed: false})
 uppyTwo
 uppyTwo
   .use(DragDrop, {target: '#UppyDragDrop-Two'})
   .use(DragDrop, {target: '#UppyDragDrop-Two'})
   .use(Tus, {endpoint: '//master.tus.io/files/'})
   .use(Tus, {endpoint: '//master.tus.io/files/'})
   .use(ProgressBar, {target: '.UppyDragDrop-Two-Progress', hideAfterFinish: false})
   .use(ProgressBar, {target: '.UppyDragDrop-Two-Progress', hideAfterFinish: false})
-  .run()
 
 
 var uploadBtn = document.querySelector('.UppyDragDrop-Two-Upload')
 var uploadBtn = document.querySelector('.UppyDragDrop-Two-Upload')
 uploadBtn.addEventListener('click', function () {
 uploadBtn.addEventListener('click', function () {

+ 2 - 3
website/src/examples/i18n/app.html

@@ -1,10 +1,10 @@
-<!-- Basic Uppy styles. You can use Transloadit's CDN, Edgly: 
+<!-- Basic Uppy styles. You can use Transloadit's CDN, Edgly:
 https://transloadit.edgly.net/releases/uppy/v0.24.2/dist/uppy.min.css -->
 https://transloadit.edgly.net/releases/uppy/v0.24.2/dist/uppy.min.css -->
 <link rel="stylesheet" href="/uppy/uppy.min.css">
 <link rel="stylesheet" href="/uppy/uppy.min.css">
 
 
 <div class="UppyDragDrop"></div>
 <div class="UppyDragDrop"></div>
 
 
-<!-- Load Uppy pre-built bundled version. You can use Transloadit's CDN, Edgly: 
+<!-- Load Uppy pre-built bundled version. You can use Transloadit's CDN, Edgly:
 https://transloadit.edgly.net/releases/uppy/v0.24.2/dist/uppy.min.js -->
 https://transloadit.edgly.net/releases/uppy/v0.24.2/dist/uppy.min.js -->
 <script src="/uppy/uppy.min.js"></script>
 <script src="/uppy/uppy.min.js"></script>
 <script>
 <script>
@@ -20,7 +20,6 @@ https://transloadit.edgly.net/releases/uppy/v0.24.2/dist/uppy.min.js -->
   });
   });
   uppy.use(Uppy.ProgressBar, { target: 'body', fixed: true, hideAfterFinish: false });
   uppy.use(Uppy.ProgressBar, { target: 'body', fixed: true, hideAfterFinish: false });
   uppy.use(Uppy.Tus, { endpoint: '//master.tus.io/files/' });
   uppy.use(Uppy.Tus, { endpoint: '//master.tus.io/files/' });
-  uppy.run();
 
 
   console.log('--> Uppy pre-built version with Tus, DragDrop & Russian language pack has loaded');
   console.log('--> Uppy pre-built version with Tus, DragDrop & Russian language pack has loaded');
 </script>
 </script>

+ 0 - 1
website/src/examples/statusbar/app.es6

@@ -8,4 +8,3 @@ uppyOne
   .use(FileInput, { target: '.UppyInput', pretty: false })
   .use(FileInput, { target: '.UppyInput', pretty: false })
   .use(Tus, { endpoint: '//master.tus.io/files/' })
   .use(Tus, { endpoint: '//master.tus.io/files/' })
   .use(StatusBar, { target: '.UppyInput-Progress', hideUploadButton: true })
   .use(StatusBar, { target: '.UppyInput-Progress', hideUploadButton: true })
-  .run()

+ 0 - 1
website/src/examples/transloadit/app.es6

@@ -59,7 +59,6 @@ function initUppy () {
     })
     })
     .use(Instagram, { target: Dashboard, host: 'https://api2.transloadit.com/uppy-server' })
     .use(Instagram, { target: Dashboard, host: 'https://api2.transloadit.com/uppy-server' })
     .use(Webcam, { target: Dashboard })
     .use(Webcam, { target: Dashboard })
-    .run()
 
 
   uppy
   uppy
     .on('transloadit:result', (stepName, result) => {
     .on('transloadit:result', (stepName, result) => {

+ 1 - 2
website/src/examples/transloadit/index.ejs

@@ -37,7 +37,7 @@ This example demonstrates how to unlock Transloadit’s features within Uppy.
     Transloadit API Key:</label>
     Transloadit API Key:</label>
   <input type="text"
   <input type="text"
          style="font-size: 15px; width: 300px; max-width: 100%; border: 0; border-bottom: 1px solid black; padding: 6px 8px; margin-bottom: 20px;"
          style="font-size: 15px; width: 300px; max-width: 100%; border: 0; border-bottom: 1px solid black; padding: 6px 8px; margin-bottom: 20px;"
-         id="transloadit-api-key" 
+         id="transloadit-api-key"
          placeholder="Your Transloadit API Key">
          placeholder="Your Transloadit API Key">
 </p>
 </p>
 
 
@@ -147,5 +147,4 @@ uppy
       .getElementById('uppy-transloadit-result')
       .getElementById('uppy-transloadit-result')
       .appendChild(resultContainer)
       .appendChild(resultContainer)
   })
   })
-  .run()
 {% endcodeblock %}
 {% endcodeblock %}

+ 0 - 1
website/src/examples/xhrupload/app.es6

@@ -15,6 +15,5 @@ uppy.use(ProgressBar, {
   fixed: true,
   fixed: true,
   hideAfterFinish: false
   hideAfterFinish: false
 })
 })
-uppy.run()
 
 
 console.log('Uppy with Formtag and XHRUpload is loaded')
 console.log('Uppy with Formtag and XHRUpload is loaded')

+ 0 - 1
website/src/uppy.ejs

@@ -21,7 +21,6 @@ permalink: uppy/
       // uppy.use(Uppy.plugins.DragDrop, {target: 'body'});
       // uppy.use(Uppy.plugins.DragDrop, {target: 'body'});
         .use(Uppy.plugins.Modal, {trigger: '#uppyModalOpener'})
         .use(Uppy.plugins.Modal, {trigger: '#uppyModalOpener'})
         .use(Uppy.plugins.Dummy, {target: Uppy.plugins.Modal})
         .use(Uppy.plugins.Dummy, {target: Uppy.plugins.Modal})
-        .run();
     </script>
     </script>
   </body>
   </body>
 </html>
 </html>

+ 2 - 3
website/themes/uppy/layout/index.ejs

@@ -85,9 +85,9 @@
 <script>
 <script>
   var PROTOCOL = location.protocol === 'https:' ? 'https' : 'http'
   var PROTOCOL = location.protocol === 'https:' ? 'https' : 'http'
   var TUS_ENDPOINT = PROTOCOL + '://master.tus.io/files/'
   var TUS_ENDPOINT = PROTOCOL + '://master.tus.io/files/'
-  
+
   var uppy = Uppy.Core({ debug: true, autoProceed: false })
   var uppy = Uppy.Core({ debug: true, autoProceed: false })
-  .use(Uppy.Dashboard, { 
+  .use(Uppy.Dashboard, {
     trigger: '#select-files',
     trigger: '#select-files',
     target: '#upload-form',
     target: '#upload-form',
     replaceTargetContent: true,
     replaceTargetContent: true,
@@ -97,7 +97,6 @@
     ]
     ]
   })
   })
   .use(Uppy.Tus, { endpoint: TUS_ENDPOINT})
   .use(Uppy.Tus, { endpoint: TUS_ENDPOINT})
-  .run()
 
 
   uppy.on('success', (files) => {
   uppy.on('success', (files) => {
     console.log(`Upload complete! We’ve uploaded these files: ${files}`)
     console.log(`Upload complete! We’ve uploaded these files: ${files}`)