aboutsummaryrefslogtreecommitdiff
path: root/src/fields/BooleanField.ts
blob: d49bfe82b57445bfe8c4c816db70cf41b052c278 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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() {
        return {
            type: Types.Boolean,
            data: this.Data,
            id: this.Id
        };
    }
}