blob: 8b276a5522937ea9f79041b44f407c241ced8f7e (
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
30
  | 
import { BasicField } from "./BasicField";
import { Field, FieldId } from "./Field";
import { Types } from "../server/Message";
export class WebField extends BasicField<URL> {
    constructor(data: URL | undefined = undefined, id?: FieldId, save: boolean = true) {
        super(data === undefined ? new URL("https://crossorigin.me/" + "https://cs.brown.edu/") : data, save, id);
    }
    toString(): string {
        return this.Data.href;
    }
    ToScriptString(): string {
        return `new WebField("${this.Data}")`;
    }
    Copy(): Field {
        return new WebField(this.Data);
    }
    ToJson() {
        return {
            type: Types.Web,
            data: this.Data.href,
            id: this.Id
        };
    }
}
 
  |