filestack / filestack-react

Official React component for Filestack - API and content management system that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.
https://www.filestack.com
MIT License
164 stars 41 forks source link

Feature Request: Add More Callback Functions #31

Closed Diasporism closed 6 years ago

Diasporism commented 6 years ago

First of all, thanks for putting together a React component for all of us Filestack users!

As a feature request I'd love to see more optional callbacks such as onFileUploadProgress and those listed in https://www.filestack.com/docs/javascript-api/pick-v3.

Is adding any more of these callbacks on the roadmap?

samuxyz commented 6 years ago

Hey @Diasporism, im sorry for the late response. If you want to use any of those functions such as onFileUploadProgress, you just have to pass the them in the options prop!

Taken from the official documentation (https://www.filestack.com/docs/javascript-api/picker-examples-v3):

client.pick({
  uploadInBackground: false,
  hideWhenUploading: true,
  startUploadingWhenMaxFilesReached: true,
  onFileUploadProgress: function(file, progressEvent) {
    console.log(JSON.stringify(progressEvent.totalPercent))
  }
}).then(function(result) {
  console.log(JSON.stringify(result.filesUploaded))
})

onFileUploadProgress is nothing more than a parameter for pick.

samuxyz commented 6 years ago

Btw, I am going to close it as it's like a duplicate of #30