Re: [whatwg/dom] Support `AbortSignal`s in `addEventListener`s options to unsubscribe from events? (#911)

> I see, so this would remove event listeners upon the signal that is associated with them being aborted? I haven't seen suggestions for this.


Yes, basically it would be a way to make working with `EventTarget`s more consistent with other DOM APIs.

For example: the person who asked me for this said "I need to make a few requests and subscribe to a few events when the user navigates to a certain page in my SPA. I am already using an AbortController to abort all the pending requests if the user navigates away - it would be very useful to also unsubscribe from all events the same way essentially having one way to 'cleanup' "

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/911#issuecomment-718837754

Received on Thursday, 29 October 2020 15:40:47 UTC