diff options
author | 2022-07-30 09:16:45 +0200 | |
---|---|---|
committer | 2022-07-30 14:16:45 +0700 | |
commit | 50cb93948c8ce0fe23a8f4dd8a62184562257220 (patch) | |
tree | 8a9c8180b9059c35f7468b9c69c49df4103f462c /source/features/quick-repo-deletion.tsx | |
parent | 808c68f3745cfe15d1995546d5519b75dc9386e1 (diff) | |
download | refined-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/quick-repo-deletion.tsx')
-rw-r--r-- | source/features/quick-repo-deletion.tsx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/features/quick-repo-deletion.tsx b/source/features/quick-repo-deletion.tsx index 9eb040e9..e8d2fee4 100644 --- a/source/features/quick-repo-deletion.tsx +++ b/source/features/quick-repo-deletion.tsx @@ -2,11 +2,11 @@ import './quick-repo-deletion.css'; import delay from 'delay'; import React from 'dom-chef'; import select from 'select-dom'; -import delegate from 'delegate-it'; import {TrashIcon} from '@primer/octicons-react'; import elementReady from 'element-ready'; import {assertError} from 'ts-extras'; import * as pageDetect from 'github-url-detection'; +import delegate, {DelegateEvent} from 'delegate-it'; import features from '.'; import * as api from '../github-helpers/api'; @@ -16,7 +16,7 @@ import addNotice from '../github-widgets/notice-bar'; import looseParseInt from '../helpers/loose-parse-int'; import parseBackticks from '../github-helpers/parse-backticks'; -function handleToggle(event: delegate.Event<Event, HTMLDetailsElement>): void { +function handleToggle(event: DelegateEvent<Event, HTMLDetailsElement>): void { const hasContent = select.exists([ '[data-hotkey="g i"] .Counter:not([hidden])', // Open issues '[data-hotkey="g p"] .Counter:not([hidden])', // Open PRs @@ -126,7 +126,7 @@ async function start(buttonContainer: HTMLDetailsElement): Promise<void> { } } -async function init(): Promise<Deinit | false> { +async function init(signal: AbortSignal): Promise<void | false> { if ( // Only if the user can delete the repository !await elementReady('nav [data-content="Settings"]') @@ -151,7 +151,7 @@ async function init(): Promise<Deinit | false> { </li>, ); - return delegate(document, '.rgh-quick-repo-deletion[open]', 'toggle', handleToggle, true); + delegate(document, '.rgh-quick-repo-deletion[open]', 'toggle', handleToggle, {capture: true, signal}); } void features.add(import.meta.url, { |