mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
feat: add onMany to BaseEventManager (#25492)
Use a map of events instead of array of tuples for better ergonomics.
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user