aboutsummaryrefslogtreecommitdiff
path: root/src/new_fields/URLField.ts
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-05-21 12:35:38 -0400
committerbob <bcz@cs.brown.edu>2019-05-21 12:35:38 -0400
commita8717e39df75cbd1fd13435ee9028f230a833399 (patch)
treea17bf828e79e0f20ceb55546915d0bf4be41928e /src/new_fields/URLField.ts
parent7bafa21e8c37826686a012151674b71631fa9c8b (diff)
parentcfb7fdb1a7b2db263502677e57ee882a6fe23f13 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/new_fields/URLField.ts')
-rw-r--r--src/new_fields/URLField.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/new_fields/URLField.ts b/src/new_fields/URLField.ts
index a6f8f1cc5..4a2841fb6 100644
--- a/src/new_fields/URLField.ts
+++ b/src/new_fields/URLField.ts
@@ -18,13 +18,18 @@ export abstract class URLField extends ObjectField {
@serializable(url())
readonly url: URL;
- constructor(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}(new URL(${this.url.href}))`;
+ return `new ${this.constructor.name}("${this.url.href}")`;
}
[Copy](): this {