Archived
Private
Public Access
1
0

Initial commit

This commit is contained in:
2022-09-04 12:45:01 +02:00
commit f4a01d6a69
11601 changed files with 4206660 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
namespace TSE {
export enum MessagePriority {
NORMAL,
HIGH
}
export class Message {
public code: string;
public context: any;
public sender: any;
public priority: MessagePriority;
public constructor(code: string, sender: any, context?: any, priority: MessagePriority = MessagePriority.NORMAL) {
this.code = code;
this.context = context;
this.sender = sender;
this.priority = priority;
}
public static send(code: string, sender: any, context?: any): void {
MessageBus.post(new Message(code, sender, context));
}
public static sendPriority(code: string, sender: any, context?: any): void {
MessageBus.post(new Message(code, sender, context, MessagePriority.HIGH));
}
public static subscribe(code: string, handler: IMessageHanlder): void {
MessageBus.addSubscription(code, handler);
}
public static unsubscribe(code: string, handler: IMessageHanlder): void {
MessageBus.removeSubscription(code, handler);
}
}
}