aboutsummaryrefslogtreecommitdiff
path: root/src/server/Message.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/Message.ts')
-rw-r--r--src/server/Message.ts86
1 files changed, 53 insertions, 33 deletions
diff --git a/src/server/Message.ts b/src/server/Message.ts
index 05ae0f19a..0274609bb 100644
--- a/src/server/Message.ts
+++ b/src/server/Message.ts
@@ -9,12 +9,12 @@ export class Message<T> {
}
get Message(): string {
- return this.guid
+ return this.guid;
}
constructor(name: string) {
this.name = name;
- this.guid = Utils.GenerateDeterministicGuid(name)
+ this.guid = Utils.GenerateDeterministicGuid(name);
}
GetValue() {
@@ -31,8 +31,8 @@ export class SetFieldArgs {
value: any;
constructor(f: string, v: any) {
- this.field = f
- this.value = v
+ this.field = f;
+ this.value = v;
}
}
@@ -40,37 +40,55 @@ export class GetFieldArgs {
field: string;
constructor(f: string) {
- this.field = f
+ this.field = f;
}
}
export enum Types {
- Number, List, Key, Image, Web, Document, Text, RichText, DocumentReference, Html, Video, Audio, Ink, PDF, Tuple, HistogramOp
+ Number,
+ List,
+ Key,
+ Image,
+ Web,
+ Document,
+ Text,
+ RichText,
+ DocumentReference,
+ Html,
+ Video,
+ Audio,
+ Ink,
+ PDF,
+ Tuple,
+ HistogramOp,
+ Boolean
}
export class DocumentTransfer implements Transferable {
- readonly type = Types.Document
- _id: string
+ readonly type = Types.Document;
+ _id: string;
- constructor(readonly obj: { type: Types, data: [string, string][], _id: string }) {
- this._id = obj._id
+ constructor(
+ readonly obj: { type: Types; data: [string, string][]; _id: string }
+ ) {
+ this._id = obj._id;
}
}
export class ImageTransfer implements Transferable {
- readonly type = Types.Image
+ readonly type = Types.Image;
constructor(readonly _id: string) { }
}
export class KeyTransfer implements Transferable {
- name: string
- readonly _id: string
- readonly type = Types.Key
+ name: string;
+ readonly _id: string;
+ readonly type = Types.Key;
constructor(i: string, n: string) {
- this.name = n
- this._id = i
+ this.name = n;
+ this._id = i;
}
}
@@ -81,45 +99,47 @@ export class ListTransfer implements Transferable {
}
export class NumberTransfer implements Transferable {
- readonly type = Types.Number
+ readonly type = Types.Number;
constructor(readonly value: number, readonly _id: string) { }
}
export class TextTransfer implements Transferable {
- value: string
- readonly _id: string
- readonly type = Types.Text
+ value: string;
+ readonly _id: string;
+ readonly type = Types.Text;
constructor(t: string, i: string) {
- this.value = t
- this._id = i
+ this.value = t;
+ this._id = i;
}
}
export class RichTextTransfer implements Transferable {
- value: string
- readonly _id: string
- readonly type = Types.Text
+ value: string;
+ readonly _id: string;
+ readonly type = Types.Text;
constructor(t: string, i: string) {
- this.value = t
- this._id = i
+ this.value = t;
+ this._id = i;
}
}
export interface Transferable {
- readonly _id: string
- readonly type: Types
+ readonly _id: string;
+ readonly type: Types;
}
export namespace MessageStore {
export const Foo = new Message<string>("Foo");
export const Bar = new Message<string>("Bar");
export const AddDocument = new Message<DocumentTransfer>("Add Document");
- export const SetField = new Message<{ _id: string, data: any, type: Types }>("Set Field")
- export const GetField = new Message<string>("Get Field")
- export const GetFields = new Message<string[]>("Get Fields")
+ export const SetField = new Message<{ _id: string; data: any; type: Types }>(
+ "Set Field"
+ );
+ export const GetField = new Message<string>("Get Field");
+ export const GetFields = new Message<string[]>("Get Fields");
export const GetDocument = new Message<string>("Get Document");
export const DeleteAll = new Message<any>("Delete All");
-} \ No newline at end of file
+}