mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 23:51:58 +00:00
remove useless toast delay
This commit is contained in:
@@ -1,13 +1,5 @@
|
|||||||
import type { ToastData, ToastNotification } from '@decky/api';
|
import type { ToastData, ToastNotification } from '@decky/api';
|
||||||
import {
|
import { ErrorBoundary, Patch, callOriginal, findModuleExport, injectFCTrampoline, replacePatch } from '@decky/ui';
|
||||||
ErrorBoundary,
|
|
||||||
Patch,
|
|
||||||
callOriginal,
|
|
||||||
findModuleExport,
|
|
||||||
injectFCTrampoline,
|
|
||||||
replacePatch,
|
|
||||||
sleep,
|
|
||||||
} from '@decky/ui';
|
|
||||||
|
|
||||||
import Toast from './components/Toast';
|
import Toast from './components/Toast';
|
||||||
import Logger from './logger';
|
import Logger from './logger';
|
||||||
@@ -29,8 +21,6 @@ declare global {
|
|||||||
|
|
||||||
class Toaster extends Logger {
|
class Toaster extends Logger {
|
||||||
private toastPatch?: Patch;
|
private toastPatch?: Patch;
|
||||||
private markReady!: () => void;
|
|
||||||
private ready = new Promise<void>((r) => (this.markReady = r));
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super('Toaster');
|
super('Toaster');
|
||||||
@@ -53,7 +43,6 @@ class Toaster extends Logger {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.log('Initialized');
|
this.log('Initialized');
|
||||||
sleep(4000).then(this.markReady);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toast(toast: ToastData): ToastNotification {
|
toast(toast: ToastData): ToastNotification {
|
||||||
@@ -120,7 +109,11 @@ class Toaster extends Logger {
|
|||||||
}
|
}
|
||||||
}, toast.expiration);
|
}, toast.expiration);
|
||||||
}
|
}
|
||||||
this.ready.then(() => window.NotificationStore.ProcessNotification(info, toastData, ToastType.New));
|
try {
|
||||||
|
window.NotificationStore.ProcessNotification(info, toastData, ToastType.New);
|
||||||
|
} catch (e) {
|
||||||
|
this.error('Error while sending toast:', e);
|
||||||
|
}
|
||||||
return toastResult;
|
return toastResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user