UNPKG

478 BJavaScriptView Raw
1const throttle = require('lodash.throttle')
2
3function _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
15module.exports = throttle(_emitSocketProgress, 300, {
16 leading: true,
17 trailing: true
18})