diff options
author | 2022-03-18 11:36:42 +0100 | |
---|---|---|
committer | 2022-03-18 11:36:42 +0100 | |
commit | afb434cd033a085cf7b226b0d6f8d84f326813d6 (patch) | |
tree | 766cd46b22a1d38433bac61aecbc1db7b6473797 /source/features/toggle-files-button.tsx | |
parent | a6dfe8444665bd639a14ab3094029486ea7efc03 (diff) | |
download | refined-github-afb434cd033a085cf7b226b0d6f8d84f326813d6.tar.gz refined-github-afb434cd033a085cf7b226b0d6f8d84f326813d6.tar.zst refined-github-afb434cd033a085cf7b226b0d6f8d84f326813d6.zip |
Meta: Correctly deinit all features (#5422)
Co-authored-by: Federico Brigante <me@fregante.com>
Diffstat (limited to 'source/features/toggle-files-button.tsx')
-rw-r--r-- | source/features/toggle-files-button.tsx | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source/features/toggle-files-button.tsx b/source/features/toggle-files-button.tsx index d66b54ed..b6b02098 100644 --- a/source/features/toggle-files-button.tsx +++ b/source/features/toggle-files-button.tsx @@ -35,14 +35,16 @@ async function toggleHandler(): Promise<void> { await (isHidden ? cache.set(cacheKey, true) : cache.delete(cacheKey)); } -async function init(): Promise<void> { +async function init(): Promise<Deinit[]> { const repoContent = (await elementReady('.repository-content'))!; - observeElement(repoContent, addButton); - delegate(document, '.rgh-toggle-files', 'click', toggleHandler); - if (await cache.get<boolean>(cacheKey)) { repoContent.classList.add('rgh-files-hidden'); } + + return [ + observeElement(repoContent, addButton), + delegate(document, '.rgh-toggle-files', 'click', toggleHandler), + ]; } void features.add(import.meta.url, { |