diff options
author | ab <abdullah_ahmed@brown.edu> | 2019-05-21 16:37:41 -0400 |
---|---|---|
committer | ab <abdullah_ahmed@brown.edu> | 2019-05-21 16:37:41 -0400 |
commit | 33c29d0e58c1b083e72df7e7fd81bb130f46bd2a (patch) | |
tree | f87bd33e2d98ce2752abec9d189de0de5161fddb /src/new_fields/URLField.ts | |
parent | b3f1e5f60ee4a00522d3e4b0b03495685bde006c (diff) | |
parent | 7e5ba95b02e4ead3ee2b41eca1af0acb72d6f7cd (diff) |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into cont_menu_ui
Diffstat (limited to 'src/new_fields/URLField.ts')
-rw-r--r-- | src/new_fields/URLField.ts | 9 |
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 { |