mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-30 05:23:05 +00:00
18 lines
444 B
JavaScript
18 lines
444 B
JavaScript
import throttle from 'lodash.throttle'
|
|
|
|
function emitSocketProgress (uploader, progressData, file) {
|
|
const { progress, bytesUploaded, bytesTotal } = progressData
|
|
if (progress) {
|
|
uploader.uppy.log(`Upload progress: ${progress}`)
|
|
uploader.uppy.emit('upload-progress', file, {
|
|
uploader,
|
|
bytesUploaded,
|
|
bytesTotal,
|
|
})
|
|
}
|
|
}
|
|
|
|
export default throttle(emitSocketProgress, 300, {
|
|
leading: true,
|
|
trailing: true,
|
|
})
|