Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for cancel event in file selection input #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nnmax
Copy link

@nnmax nnmax commented Dec 11, 2024

This PR adds the ability to listen for the cancel event. When the cancel event is fired, the promise is rejected.

Currently, if the user cancels the upload, the promise is always in pending state, which should not make sense.

I am using this great library to implement image upload functionality. Currently I need to listen to the user's cancel action. I'm sure others will have this need as well.

Modern browsers already implement the Input's Cancel event, so it only takes a small amount of code to implement this functionality.

references:

  1. https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/cancel_event
  2. https://caniuse.com/mdn-api_htmlinputelement_cancel_event

fixed: #50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for cancel event in file selection input
1 participant