dfa1234 / ngx-image-compress

Angular library for uploading and compressing images
https://image-library.app
MIT License
86 stars 37 forks source link

UploadFile promise rejects when ChooseFileWindow closes without a fil… #82

Closed ModestinoAndre closed 2 years ago

ModestinoAndre commented 2 years ago

UploadFile promise rejects when ChooseFileWindow closes without a file (operation canceled).

Today we no ways to know when a user closes the Choose-File-Window. This patch makes UploadFile() promise returns a rejection with an error code equals to 'CANCEL' when that happens.

netlify[bot] commented 2 years ago

Deploy Preview for ngx-image-compress ready!

Name Link
Latest commit ce6f997df099482d836d98c2f12f7fb6e831049c
Latest deploy log https://app.netlify.com/sites/ngx-image-compress/deploys/6244d5ea04b22b00086128d5
Deploy Preview https://deploy-preview-82--ngx-image-compress.netlify.app/
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

dfa1234 commented 2 years ago

Thank a lot @ModestinoAndre for this PR on point. We will make some change for creating a new function in the service doing exactly what you want to do. A new method is preferred in order to keep the library 100% backward compatible and do not broke code of older project with promise rejection not handled. Also, at first, we found more logic to not do nothing nor reject the promise if the user did nothing (no file was selected), so I think a separate method is preferred. We will push your code in the current week.

ModestinoAndre commented 2 years ago

You are welcome @dfa1234, I'm happy to help. And, thanks for your time and your work on this awesome lib.

dfa1234 commented 2 years ago

@ModestinoAndre you commit have been cherry-picked here in this pull request: #89 Thanks again