diff --git a/Sources/ECMASwift/API/URL/URL.swift b/Sources/ECMASwift/API/URL/URL.swift index 2709450..f56c6d9 100644 --- a/Sources/ECMASwift/API/URL/URL.swift +++ b/Sources/ECMASwift/API/URL/URL.swift @@ -6,6 +6,7 @@ protocol URLExports: JSExport { var `protocol`: String { get set } var hostname: String { get set } var host: String { get set } + var href: String { get set } var pathname: String { get set } var port: String { get set } var origin: String { get set } @@ -69,6 +70,13 @@ final class URL: NSObject, URLExports { get { return url?.host ?? "" } set(newValue) { setURLComponent(\.host, value: newValue) } } + + var href: String { + get { return toString() } + set(newValue) { + self.url = Foundation.URL(string: newValue) + } + } var pathname: String { get { return url?.path ?? "" }