Signal handling with AbortController #181
adrianspacely
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Just sharing if anyone finds this useful or wants to PR it.
Javascript event listeners and fetch/axios calls accept a signal option. This allows the listener to be removed or the request to be cancelled when an abort signal comes in.
https://developer.mozilla.org/en-US/docs/Web/API/AbortController
I wrapped a proxy around my emitter to handle this:
Example:
Beta Was this translation helpful? Give feedback.
All reactions