|
@@ -68,16 +68,6 @@ export default class Tus10 extends Plugin {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- // pauseResumeAll (action) {
|
|
|
|
- // let updatedFiles = Object.assign({}, this.core.getState().files)
|
|
|
|
- // updatedFiles = Object.keys(updatedFiles).map((file) => {
|
|
|
|
- // return Object.assign({}, updatedFiles[file], {
|
|
|
|
- // isPaused: action
|
|
|
|
- // })
|
|
|
|
- // })
|
|
|
|
- // this.core.setState({files: updatedFiles})
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* Create a new Tus upload
|
|
* Create a new Tus upload
|
|
*
|
|
*
|
|
@@ -220,11 +210,15 @@ export default class Tus10 extends Plugin {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
- return Promise.all(uploaders).then(() => {
|
|
|
|
- return {
|
|
|
|
- uploadedCount: files.length
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ return Promise.all(uploaders)
|
|
|
|
+ .then(() => {
|
|
|
|
+ return {
|
|
|
|
+ uploadedCount: files.length
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ this.core.log('All files uploaded')
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
selectForUpload (files) {
|
|
selectForUpload (files) {
|
|
@@ -252,16 +246,24 @@ export default class Tus10 extends Plugin {
|
|
this.core.emitter.on('core:resume-all', () => {
|
|
this.core.emitter.on('core:resume-all', () => {
|
|
this.pauseResume('resumeAll')
|
|
this.pauseResume('resumeAll')
|
|
})
|
|
})
|
|
- }
|
|
|
|
|
|
|
|
- install () {
|
|
|
|
- this.actions()
|
|
|
|
-
|
|
|
|
- const bus = this.core.emitter
|
|
|
|
- bus.on('core:upload', () => {
|
|
|
|
|
|
+ this.core.emitter.on('core:upload', () => {
|
|
this.core.log('Tus is uploading...')
|
|
this.core.log('Tus is uploading...')
|
|
const files = this.core.getState().files
|
|
const files = this.core.getState().files
|
|
this.selectForUpload(files)
|
|
this.selectForUpload(files)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ addResumableUploadsCapabilityFlag () {
|
|
|
|
+ const newCapabilities = Object.assign({}, this.core.getState().capabilities)
|
|
|
|
+ newCapabilities.resumableUploads = true
|
|
|
|
+ this.core.setState({
|
|
|
|
+ capabilities: newCapabilities
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ install () {
|
|
|
|
+ this.addResumableUploadsCapabilityFlag()
|
|
|
|
+ this.actions()
|
|
|
|
+ }
|
|
}
|
|
}
|