refactor: event manager (#25481)

* refactor: event manager

* fix: broken downloadFile endpoint
This commit is contained in:
Jason Rasmussen
2026-01-23 18:02:23 -05:00
committed by GitHub
parent b52e8cd570
commit 4fedae4150
16 changed files with 45 additions and 116 deletions
@@ -8,9 +8,10 @@
};
const props: Props = $props();
const unsubscribes: Array<() => void> = [];
onMount(() => {
const unsubscribes: Array<() => void> = [];
for (const name of Object.keys(props)) {
const event = name.slice(2) as keyof Events;
const listener = props[name as keyof Props] as EventCallback<Events, typeof event> | undefined;
+3 -3
View File
@@ -7,9 +7,10 @@
};
const props: Props = $props();
const unsubscribes: Array<() => void> = [];
onMount(() => {
const unsubscribes: Array<() => void> = [];
for (const name of Object.keys(props)) {
const event = name.slice(2) as keyof Events;
const listener = props[name as keyof Props];
@@ -20,8 +21,7 @@
const args = [event, listener as (...args: Events[typeof event]) => void] as const;
eventManager.on(...args);
unsubscribes.push(() => eventManager.off(...args));
unsubscribes.push(eventManager.on(...args));
}
return () => {