|
@@ -101,6 +101,14 @@ class Uppy {
|
|
|
return this.state
|
|
|
}
|
|
|
|
|
|
+ reset () {
|
|
|
+ this.emit('core:pause-all')
|
|
|
+ this.emit('core:cancel-all')
|
|
|
+ this.setState({
|
|
|
+ totalProgress: 0
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
addPreProcessor (fn) {
|
|
|
this.preProcessors.push(fn)
|
|
|
}
|
|
@@ -292,10 +300,9 @@ class Uppy {
|
|
|
})
|
|
|
|
|
|
this.on('core:cancel-all', () => {
|
|
|
- const files = this.getState().files
|
|
|
- Object.keys(files).forEach((file) => {
|
|
|
- this.removeFile(files[file].id)
|
|
|
- })
|
|
|
+ let updatedFiles = this.getState().files
|
|
|
+ updatedFiles = {}
|
|
|
+ this.setState({files: updatedFiles})
|
|
|
})
|
|
|
|
|
|
this.on('core:upload-started', (fileID, upload) => {
|
|
@@ -508,6 +515,8 @@ class Uppy {
|
|
|
* Uninstall all plugins and close down this Uppy instance.
|
|
|
*/
|
|
|
close () {
|
|
|
+ this.reset()
|
|
|
+
|
|
|
this.iteratePlugins((plugin) => {
|
|
|
plugin.uninstall()
|
|
|
})
|