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

[Feature] Add rejectOnTimeout & onLoadingSlow #70

Open
MattCCC opened this issue Oct 1, 2024 · 0 comments
Open

[Feature] Add rejectOnTimeout & onLoadingSlow #70

MattCCC opened this issue Oct 1, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@MattCCC
Copy link
Owner

MattCCC commented Oct 1, 2024

The idea is to add two options into the plugin

The onLoadingSlow (null by default) feature is a user-friendly addition that helps monitor slow network conditions or when the server is taking longer than expected to respond. This callback function triggers when a request takes longer than a specified threshold (typically shorter than the timeout limit) but hasn't yet timed out. This provides an opportunity to show a loading indicator, display a message, or offer a cancel option to the user.

The rejectOnTimeout (true by default although that requires some more thought) feature ensures that any request exceeding the specified timeout duration is forcefully rejected. When enabled, this option automatically cancels the request and throws an error if the timeout limit is reached. This behavior is particularly useful for preventing indefinitely hanging requests, ensuring that your application doesn’t wait forever for a response from the server.

@MattCCC MattCCC added the enhancement New feature or request label Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant