feat: add onMany to BaseEventManager (#25492)

Use a map of events instead of array of tuples for better ergonomics.
This commit is contained in:
Min Idzelis
2026-01-26 10:34:26 -05:00
committed by GitHub
parent 836d22570f
commit 646bb372ab
4 changed files with 23 additions and 6 deletions
+4 -2
View File
@@ -23,8 +23,10 @@ class MemoryStoreSvelte {
#loading: Promise<void> | undefined;
constructor() {
eventManager.on('AuthLogout', () => this.clearCache());
eventManager.on('AuthUserLoaded', () => this.initialize());
eventManager.onMany({
AuthLogout: () => this.clearCache(),
AuthUserLoaded: () => this.initialize(),
});
}
ready() {
@@ -8,8 +8,10 @@ class NotificationStore {
notifications = $state<NotificationDto[]>([]);
constructor() {
eventManager.on('AuthLogin', () => this.refresh());
eventManager.on('AuthLogout', () => this.clear());
eventManager.onMany({
AuthLogin: () => this.refresh(),
AuthLogout: () => this.clear(),
});
}
async refresh() {