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/prevent-duplicate-pr-submission.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/prevent-duplicate-pr-submission.tsx')
-rw-r--r-- | source/features/prevent-duplicate-pr-submission.tsx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/features/prevent-duplicate-pr-submission.tsx b/source/features/prevent-duplicate-pr-submission.tsx index 61dfb272..2b03eb1f 100644 --- a/source/features/prevent-duplicate-pr-submission.tsx +++ b/source/features/prevent-duplicate-pr-submission.tsx @@ -1,11 +1,11 @@ -import delegate from 'delegate-it'; import * as pageDetect from 'github-url-detection'; +import delegate, {DelegateEvent} from 'delegate-it'; import features from '.'; let previousSubmission = 0; -function preventSubmit(event: delegate.Event): void { +function preventSubmit(event: DelegateEvent): void { if (Date.now() - previousSubmission < 1000) { event.preventDefault(); } @@ -13,8 +13,8 @@ function preventSubmit(event: delegate.Event): void { previousSubmission = Date.now(); } -function init(): Deinit { - return delegate(document, '#new_pull_request', 'submit', preventSubmit); +function init(signal: AbortSignal): void { + delegate(document, '#new_pull_request', 'submit', preventSubmit, {signal}); } void features.add(import.meta.url, { |