aboutsummaryrefslogtreecommitdiff
path: root/src/fields/IconField.ts
blob: 33e5be7afaea914862bebfda98e9711e64b39922 (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
26
27
28
29
import { serializable, primitive } from 'serializr';
import { Deserializable } from '../client/util/SerializationHelper';
import { ObjectField } from './ObjectField';
import { Copy, ToJavascriptString, ToScriptString, ToString } from './FieldSymbols';

@Deserializable('icon')
export class IconField extends ObjectField {
    @serializable(primitive())
    readonly icon: string;

    constructor(icon: string) {
        super();
        this.icon = icon;
    }

    [Copy]() {
        return new IconField(this.icon);
    }

    [ToJavascriptString]() {
        return 'invalid';
    }
    [ToScriptString]() {
        return 'invalid';
    }
    [ToString]() {
        return 'ICONfield';
    }
}