diff options
| author | Party Wumpus <48649272+PartyWumpus@users.noreply.github.com> | 2024-02-15 22:28:36 +0000 |
|---|---|---|
| committer | Party Wumpus <48649272+PartyWumpus@users.noreply.github.com> | 2024-02-15 22:28:36 +0000 |
| commit | 867ce63f7bc67cb418d96d226a7e3eaf2b05bc87 (patch) | |
| tree | 5424e3374c2f66e25d6fa0a80bc4f6f3e18fa84d /frontend/src/components/settings | |
| parent | ee6122b97d042e8bb50531511d6c0103e0d6a358 (diff) | |
| download | decky-loader-867ce63f7bc67cb418d96d226a7e3eaf2b05bc87.tar.gz decky-loader-867ce63f7bc67cb418d96d226a7e3eaf2b05bc87.zip | |
Add event handler
Diffstat (limited to 'frontend/src/components/settings')
| -rw-r--r-- | frontend/src/components/settings/pages/general/Updater.tsx | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/frontend/src/components/settings/pages/general/Updater.tsx b/frontend/src/components/settings/pages/general/Updater.tsx index 26537b58..645252fe 100644 --- a/frontend/src/components/settings/pages/general/Updater.tsx +++ b/frontend/src/components/settings/pages/general/Updater.tsx @@ -77,16 +77,20 @@ export default function UpdaterSettings() { const { t } = useTranslation(); useEffect(() => { - window.DeckyUpdater = { - updateProgress: (i) => { - setUpdateProgress(i); - setIsLoaderUpdating(true); - }, - finish: async () => { - setUpdateProgress(0); - setReloading(true); - await doRestart(); - }, + const a = DeckyBackend.addEventListener('frontend/update_download_percentage', (percentage) => { + setUpdateProgress(percentage); + setIsLoaderUpdating(true); + }); + + const b = DeckyBackend.addEventListener('frontend/finish_download', async () => { + setUpdateProgress(0); + setReloading(true); + await doRestart(); + }); + + return () => { + DeckyBackend.removeEventListener('frontend/update_download_percentage', a); + DeckyBackend.removeEventListener('frontend/finish_download', b); }; }, []); |
