aboutsummaryrefslogtreecommitdiff
path: root/src/new_fields/RefField.ts
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-05-17 21:52:49 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-05-17 21:52:49 -0400
commit618b4a42795b59cde47510b86b6e25dc03e15935 (patch)
treef10a9f093df478db15e94fbf8992a32fe8ba99d0 /src/new_fields/RefField.ts
parent19fca408a19c5f7a759ff6c3bfefe27b96ec3563 (diff)
parent4e244951b7b18d7973360f423e8de80c42466228 (diff)
merged
Diffstat (limited to 'src/new_fields/RefField.ts')
-rw-r--r--src/new_fields/RefField.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/new_fields/RefField.ts b/src/new_fields/RefField.ts
new file mode 100644
index 000000000..202c65f21
--- /dev/null
+++ b/src/new_fields/RefField.ts
@@ -0,0 +1,18 @@
+import { serializable, primitive, alias } from "serializr";
+import { Utils } from "../Utils";
+
+export type FieldId = string;
+export const HandleUpdate = Symbol("HandleUpdate");
+export const Id = Symbol("Id");
+export abstract class RefField {
+ @serializable(alias("id", primitive()))
+ private __id: FieldId;
+ readonly [Id]: FieldId;
+
+ constructor(id?: FieldId) {
+ this.__id = id || Utils.GenerateGuid();
+ this[Id] = this.__id;
+ }
+
+ protected [HandleUpdate]?(diff: any): void;
+}