add global event emitter

This commit is contained in:
jeffvli
2025-10-10 11:26:17 -07:00
parent b6dce7f3ca
commit e304667c08
3 changed files with 108 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
import { LibraryItem } from '/@/shared/types/domain-types';
export type EventMap = {
ITEM_LIST_REFRESH: ItemListRefreshEventPayload;
ITEM_LIST_UPDATE_ITEM: ItemListUpdateItemEventPayload;
USER_FAVORITE: UserFavoriteEventPayload;
USER_RATING: UserRatingEventPayload;
};
export type ItemListRefreshEventPayload = {
key: string;
};
export type ItemListUpdateItemEventPayload = {
index: number;
item: unknown;
key: string;
};
export type UserFavoriteEventPayload = {
favorite: boolean;
id: string[];
itemType: LibraryItem;
};
export type UserRatingEventPayload = {
id: string[];
itemType: LibraryItem;
rating: null | number;
};