blob: e456a7d16e99255d335e7e3d83dbce27a742a240 (
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 { Deserializable } from "../client/util/SerializationHelper";
import { serializable, custom } from "serializr";
import { ObjectField } from "./Doc";
function url() {
return custom(
function (value: URL) {
return value.href;
},
function (jsonValue: string) {
return new URL(jsonValue);
}
);
}
@Deserializable("url")
export class URLField extends ObjectField {
@serializable(url())
readonly url: URL;
constructor(url: URL) {
super();
this.url = url;
}
}
|