tus-js-client.js 497 B

12345678910111213141516171819202122
  1. class Upload {
  2. constructor (file, options) {
  3. this.url = 'https://tus.endpoint/files/foo-bar'
  4. this.options = options
  5. }
  6. _triggerProgressThenSuccess () {
  7. this.options.onProgress(this.options.uploadSize, this.options.uploadSize)
  8. setTimeout(() => this.options.onSuccess(), 100)
  9. }
  10. start () {
  11. setTimeout(this._triggerProgressThenSuccess.bind(this), 100)
  12. }
  13. // eslint-disable-next-line class-methods-use-this
  14. abort () {
  15. // noop
  16. }
  17. }
  18. module.exports = { Upload }