1 | const throttle = require('lodash.throttle')
|
2 |
|
3 | function _emitSocketProgress (uploader, progressData, file) {
|
4 | const { progress, bytesUploaded, bytesTotal } = progressData
|
5 | if (progress) {
|
6 | uploader.uppy.log(`Upload progress: ${progress}`)
|
7 | uploader.uppy.emit('upload-progress', file, {
|
8 | uploader,
|
9 | bytesUploaded: bytesUploaded,
|
10 | bytesTotal: bytesTotal
|
11 | })
|
12 | }
|
13 | }
|
14 |
|
15 | module.exports = throttle(_emitSocketProgress, 300, {
|
16 | leading: true,
|
17 | trailing: true
|
18 | })
|