Repository navigation
Meta: Deinit all feature delegates using AbortSignal - #5726
Conversation
cheap-glitch
left a comment
There was a problem hiding this comment.
I guess the next step is to add support for AbortSignal into selector-observer so we can get rid of Deinit completely 🙂
|
|
||
| return updateUI.cancel; |
There was a problem hiding this comment.
Thoughts?
| return updateUI.cancel; | |
| signal.addEventListener('abort', updateUI.cancel); |
I'd love to have an onAbort(emitter: signal, listener: function | controller) helper for this kind of situations:
| return updateUI.cancel; | |
| onAbort(signal, updateUI.cancel) |
and also when we have multiple controllers and we want to link them together, like:
function foo(otherSignal) {
const controller = new AbortController
onAbort(otherSignal, controller)
return controller;
}In this case, controller would also be aborted when otherSignal is aborted.
I'm not sure it's useful in this specific case though, return fn will always be more convenient.
There was a problem hiding this comment.
For this specific case we should just drop this. There's no chance that the user changes page within 300ms of the last keypress
| delegate(document, '.rgh-prevent-link-loss', 'click', handleButtonClick), | ||
| ]; | ||
| function init(signal: AbortSignal): Deinit { | ||
| delegate(document, 'form:is(#new_issue, #new_release) textarea, form.js-new-comment-form textarea, textarea.comment-form-textarea', 'input', updateUI, {signal}); |
There was a problem hiding this comment.
Multiline selector? Maybe in the lint PR after this one is merged
AbortSignalAbortSignal
|
Ping on this if you have time, the onAbort helper was added. I resolved all the comments that are no longer applicable, this only needs conflict resolution and a couple more changes |





Uh oh!
There was an error while loading. Please reload this page.