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

feat: [#1468] Add AbortSignal.any() static method #1469

Merged
merged 5 commits into from
Aug 28, 2024

Conversation

ezzatron
Copy link
Contributor

@ezzatron ezzatron commented Jun 25, 2024

This PR adds the AbortSignal.any() static method.

This method is extremely useful for combining multiple signals together. An example would be adding a timeout to a manually aborted signal:

const timeout = AbortSignal.timeout(10000);
const controller = new AbortController();

const signal = AbortSignal.any([timeout, controller.signal]);

// Will abort after 10 seconds, or when controller.abort() is called
await fetch("https://example.org/, { signal });

capricorn86
capricorn86 previously approved these changes Aug 21, 2024
Copy link
Owner

@capricorn86 capricorn86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution @ezzatron! 🌟

Sorry that you had to wait for so long time before getting this in.

@capricorn86
Copy link
Owner

@ezzatron This PR got blocket because some of the integration tests failed. The integration tests loads Github.com, and apparently they released something that broke Happy DOM. I'm working on it, but perhaps it would be good to integration test a more stable target in the future.

@capricorn86 capricorn86 merged commit 3e1191e into capricorn86:master Aug 28, 2024
3 checks passed
@capricorn86
Copy link
Owner

capricorn86 commented Aug 28, 2024

@ezzatron it has finally been merged. I had to do some fixes, so that we use the class from the Window object, as it has to be bound to the Window context 🙂

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.

2 participants