aboutsummaryrefslogtreecommitdiff
path: root/src/fields/NumberField.ts
blob: 47dfc74cb275dda9fcb3dcbc60fd9a4702ff4ac0 (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 { Types } from "../server/Message";
import { FieldId } from "./Field";

export class NumberField extends BasicField<number> {
    constructor(data: number = 0, id?: FieldId, save: boolean = true) {
        super(data, save, id);
    }

    ToScriptString(): string {
        return "new NumberField(this.Data)";
    }

    Copy() {
        return new NumberField(this.Data);
    }

    ToJson(): { _id: string, type: Types, data: number } {
        return {
            _id: this.Id,
            type: Types.Number,
            data: this.Data
        }
    }
}