aboutsummaryrefslogtreecommitdiff
path: root/src/new_fields/URLField.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/new_fields/URLField.ts')
-rw-r--r--src/new_fields/URLField.ts53
1 files changed, 0 insertions, 53 deletions
diff --git a/src/new_fields/URLField.ts b/src/new_fields/URLField.ts
deleted file mode 100644
index fb71160ca..000000000
--- a/src/new_fields/URLField.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import { Deserializable } from "../client/util/SerializationHelper";
-import { serializable, custom } from "serializr";
-import { ObjectField } from "./ObjectField";
-import { ToScriptString, ToString, Copy } from "./FieldSymbols";
-import { Scripting, scriptingGlobal } from "../client/util/Scripting";
-
-function url() {
- return custom(
- function (value: URL) {
- return value.href;
- },
- function (jsonValue: string) {
- return new URL(jsonValue);
- }
- );
-}
-
-export abstract class URLField extends ObjectField {
- @serializable(url())
- readonly url: URL;
-
- constructor(url: string);
- constructor(url: URL);
- constructor(url: URL | string) {
- super();
- if (typeof url === "string") {
- url = new URL(url);
- }
- this.url = url;
- }
-
- [ToScriptString]() {
- return `new ${this.constructor.name}("${this.url.href}")`;
- }
- [ToString]() {
- return this.url.href;
- }
-
- [Copy](): this {
- return new (this.constructor as any)(this.url);
- }
-}
-
-export const nullAudio = "https://actions.google.com/sounds/v1/alarms/beep_short.ogg";
-
-@scriptingGlobal @Deserializable("audio") export class AudioField extends URLField { }
-@scriptingGlobal @Deserializable("image") export class ImageField extends URLField { }
-@scriptingGlobal @Deserializable("video") export class VideoField extends URLField { }
-@scriptingGlobal @Deserializable("pdf") export class PdfField extends URLField { }
-@scriptingGlobal @Deserializable("web") export class WebField extends URLField { }
-@scriptingGlobal @Deserializable("youtube") export class YoutubeField extends URLField { }
-@scriptingGlobal @Deserializable("webcam") export class WebCamField extends URLField { }
-