tus-js-client.js 444 B

123456789101112131415161718192021
  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. abort () {
  14. // noop
  15. }
  16. }
  17. module.exports = { Upload }