summaryrefslogtreecommitdiff
path: root/source/features/extend-diff-expander.tsx
diff options
context:
space:
mode:
authorGravatar Florent <cheap.glitch@gmail.com> 2022-07-30 09:16:45 +0200
committerGravatar GitHub <noreply@github.com> 2022-07-30 14:16:45 +0700
commit50cb93948c8ce0fe23a8f4dd8a62184562257220 (patch)
tree8a9c8180b9059c35f7468b9c69c49df4103f462c /source/features/extend-diff-expander.tsx
parent808c68f3745cfe15d1995546d5519b75dc9386e1 (diff)
downloadrefined-github-50cb93948c8ce0fe23a8f4dd8a62184562257220.tar.gz
refined-github-50cb93948c8ce0fe23a8f4dd8a62184562257220.tar.zst
refined-github-50cb93948c8ce0fe23a8f4dd8a62184562257220.zip
Meta: Deinit all feature delegates using `AbortSignal` (#5726)
Co-authored-by: Federico Brigante <me@fregante.com>
Diffstat (limited to 'source/features/extend-diff-expander.tsx')
-rw-r--r--source/features/extend-diff-expander.tsx8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/features/extend-diff-expander.tsx b/source/features/extend-diff-expander.tsx
index 8ea375ce..b42f3e4a 100644
--- a/source/features/extend-diff-expander.tsx
+++ b/source/features/extend-diff-expander.tsx
@@ -1,19 +1,19 @@
import './extend-diff-expander.css';
import select from 'select-dom';
-import delegate from 'delegate-it';
+import delegate, {DelegateEvent} from 'delegate-it';
import * as pageDetect from 'github-url-detection';
import features from '.';
-function expandDiff(event: delegate.Event): void {
+function expandDiff(event: DelegateEvent): void {
// Skip if the user clicked directly on the icon
if (!(event.target as Element).closest('.js-expand')) {
select('.js-expand', event.delegateTarget)!.click();
}
}
-function init(): Deinit {
- return delegate(document, '.diff-view .js-expandable-line', 'click', expandDiff);
+function init(signal: AbortSignal): void {
+ delegate(document, '.diff-view .js-expandable-line', 'click', expandDiff, {signal});
}
void features.add(import.meta.url, {