mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-24 18:58:57 +00:00
[repeat] add capabilities — tus adds resumable: true
This commit is contained in:
parent
09d9436439
commit
fb932b15d1
1 changed files with 23 additions and 21 deletions
|
|
@ -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
|
||||
*
|
||||
|
|
@ -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) {
|
||||
|
|
@ -252,16 +246,24 @@ export default class Tus10 extends Plugin {
|
|||
this.core.emitter.on('core:resume-all', () => {
|
||||
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...')
|
||||
const files = this.core.getState().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()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue