1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2025-09-20 14:18:47 +00:00

Create new helper method

This commit is contained in:
2020-04-02 18:56:42 +02:00
parent a4dcf49d74
commit 29b446f20b
3 changed files with 38 additions and 12 deletions

View File

@@ -22,6 +22,21 @@ export class WsMessage implements WsMessageBuilder {
}
}
/**
* Construct quickly a message with no ID (to propagate
* events to clients)
*
* @param title The title of message
* @param data Data associated with the message
*/
public static NoIDMessage(title: string, data: any) : WsMessage {
return new this({
id: "",
title: title,
data: data
});
}
get isValidRequest() : boolean {
return typeof this.id === "string"
&& typeof this.title === "string"