diff options
author | laurawilsonri <laura_wilson@brown.edu> | 2019-04-08 19:10:03 -0400 |
---|---|---|
committer | laurawilsonri <laura_wilson@brown.edu> | 2019-04-08 19:10:03 -0400 |
commit | 74411165f21b6c616fa98e0676c6f4568c2d4564 (patch) | |
tree | 38079f721f8cdeba25e7bc0439aa5d6523927f1c /src/fields/BooleanField.ts | |
parent | 5d4414e8d2a17c75c808bce9343dba85fbb32440 (diff) | |
parent | a72fcdd0ebc06a3c851007c6ed89ab13a9a0d835 (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into richTextEditor
Diffstat (limited to 'src/fields/BooleanField.ts')
-rw-r--r-- | src/fields/BooleanField.ts | 25 |
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 + }; + } +} |