aboutsummaryrefslogtreecommitdiff
path: root/src/fields/BooleanField.ts
diff options
context:
space:
mode:
authorEleanor Eng <eleanor_eng@brown.edu>2019-04-08 17:54:30 -0400
committerEleanor Eng <eleanor_eng@brown.edu>2019-04-08 17:54:30 -0400
commit1327dc11149fc0ee774f6ee94609a4c48f901ef7 (patch)
tree4d1d5d04571fdb1d2408a606740909953c2789c1 /src/fields/BooleanField.ts
parent52b30ce1ba6748c1d0a0f8697df3e66c53b2c315 (diff)
parent3a9f6df918ad45e55b0c6a540cb566aff4940288 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into animationtimeline
Diffstat (limited to 'src/fields/BooleanField.ts')
-rw-r--r--src/fields/BooleanField.ts25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/fields/BooleanField.ts b/src/fields/BooleanField.ts
new file mode 100644
index 000000000..d319b4021
--- /dev/null
+++ b/src/fields/BooleanField.ts
@@ -0,0 +1,25 @@
+import { BasicField } from "./BasicField";
+import { FieldId } from "./Field";
+import { Types } from "../server/Message";
+
+export class BooleanField extends BasicField<boolean> {
+ constructor(data: boolean = false as boolean, id?: FieldId, save: boolean = true as boolean) {
+ super(data, save, id);
+ }
+
+ ToScriptString(): string {
+ return `new BooleanField("${this.Data}")`;
+ }
+
+ Copy() {
+ return new BooleanField(this.Data);
+ }
+
+ ToJson(): { type: Types; data: boolean; _id: string } {
+ return {
+ type: Types.Boolean,
+ data: this.Data,
+ _id: this.Id
+ };
+ }
+}