32 lines
741 B
TypeScript
Executable File
32 lines
741 B
TypeScript
Executable File
import mitt from 'mitt';
|
|
import { ObjectType, UserProfile, MessageDto, VisitType } from '@nice/common';
|
|
export enum CrudOperation {
|
|
CREATED,
|
|
UPDATED,
|
|
DELETED,
|
|
}
|
|
type Events = {
|
|
genDataEvent: { type: 'start' | 'end' };
|
|
markDirty: {
|
|
objectType: string;
|
|
id: string;
|
|
staff?: UserProfile;
|
|
subscribers?: string[];
|
|
};
|
|
updateVisitCount: {
|
|
id: string;
|
|
objectType: ObjectType;
|
|
visitType: VisitType | string;
|
|
};
|
|
updatePostState: {
|
|
id: string;
|
|
};
|
|
updateTotalCourseViewCount: {
|
|
visitType: VisitType | string;
|
|
};
|
|
onMessageCreated: { data: Partial<MessageDto> };
|
|
dataChanged: { type: string; operation: CrudOperation; data: any };
|
|
};
|
|
const EventBus = mitt<Events>();
|
|
export default EventBus;
|