UNPKG

@fractional-company/common

Version:
30 lines (29 loc) 1.12 kB
export declare type InternalEventType = { name: string; body: any; eventId?: string; }; export declare type InternalEventWithHandlerType = InternalEventType & { handler: string; }; export declare class InternalEvent<EventBody> { protected name: string; protected body: EventBody; protected eventId: string; protected handler: string | null; constructor(name: string, body: EventBody, eventId?: string); setName(name: string): this; setBody(body: EventBody): this; setEventId(eventId: string): this; setHandler(handler: string): this; getName(): string; getBody(): EventBody; getEventId(): string; getHandler(): string | null; hasHandler(): boolean; toObject(): InternalEventType | InternalEventWithHandlerType; toJson(): string; cloneWithHandler(handler: string): InternalEvent<EventBody>; static resolveFromJson<EventBody>(jsonString: string): InternalEvent<EventBody>; static resolveFromObject<EventBody>(jsonObject: InternalEventType | InternalEventWithHandlerType): InternalEvent<EventBody>; }