refactor: event manager (#25565)

This commit is contained in:
Jason Rasmussen
2026-01-29 08:52:18 -05:00
committed by GitHub
parent 8db61d341f
commit 10b53b525d
21 changed files with 84 additions and 68 deletions
+3 -1
View File
@@ -19,7 +19,9 @@ class FoldersStore {
private assets = $state<AssetCache>({});
constructor() {
eventManager.on('AuthLogout', () => this.clearCache());
eventManager.on({
AuthLogout: () => this.clearCache(),
});
}
async fetchTree(): Promise<TreeNode> {
+1 -1
View File
@@ -25,7 +25,7 @@ class MemoryStoreSvelte {
#loading: Promise<void> | undefined;
constructor() {
eventManager.onMany({
eventManager.on({
AuthLogout: () => this.clearCache(),
AuthUserLoaded: () => this.initialize(),
});
@@ -8,7 +8,7 @@ class NotificationStore {
notifications = $state<NotificationDto[]>([]);
constructor() {
eventManager.onMany({
eventManager.on({
AuthLogin: () => this.refresh(),
AuthLogout: () => this.clear(),
});
+3 -1
View File
@@ -5,7 +5,9 @@ class SearchStore {
isSearchEnabled = $state(false);
constructor() {
eventManager.on('AuthLogout', () => this.clearCache());
eventManager.on({
AuthLogout: () => this.clearCache(),
});
}
clearCache() {
+3 -1
View File
@@ -16,4 +16,6 @@ export const resetSavedUser = () => {
purchaseStore.setPurchaseStatus(false);
};
eventManager.on('AuthLogout', () => resetSavedUser());
eventManager.on({
AuthLogout: () => resetSavedUser(),
});
+3 -1
View File
@@ -26,4 +26,6 @@ const reset = () => {
Object.assign(userInteraction, defaultUserInteraction);
};
eventManager.on('AuthLogout', () => reset());
eventManager.on({
AuthLogout: () => reset(),
});