-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Support instances of EventTarget as a signal
#1001
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
Conversation
Node has added its own AbortController in 15.0.0. The AbortController signal inherits from EventTarget. This changes the check to also accept signals of type EventTarget. https://nodejs.org/docs/latest-v15.x/api/globals.html#globals_class_abortsignal
Cool - have looked forward for this! More spec'ed browser apis!
Cool - Now we also got a spec'ed EventTarget also :) |
EventTarget as a signal
EventTarget as a signalEventTarget as a signal
| object[NAME] === 'AbortSignal' | ||
| typeof object === 'object' && ( | ||
| object[NAME] === 'AbortSignal' || | ||
| object[NAME] === 'EventTarget' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this. On Node.js v15.3.0, I see
> new AbortController().signal[Symbol.toStringTag]
'AbortSignal'So it seems like a bug to accept non-AbortSignal EventTarget objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// @worr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just notice this. yea, it's weird that we check for the name EventTarget. a proper test was not even created... still using the polyfill for this...
node v12 goes EOL soon, so we are thinking of dropping support for node below v14.17 so that we can start using AbortController/AbortSignal provided by NodeJS so that we can pass this signal directly to node's own http.request.
Will create an issue for this. (targeted for v4)
Node has added its own AbortController in 15.0.0. The AbortController signal
inherits from EventTarget. This changes the check to also accept signals of
type EventTarget.
https://nodejs.org/docs/latest-v15.x/api/globals.html#globals_class_abortsignal
What is the purpose of this pull request?
What changes did you make? (provide an overview)
Modified the
isAbortSignalcheck to acceptEventTargetas well.Which issue (if any) does this pull request address?
Incompatibility with the new node
AbortController