Skip to content

Commit

Permalink
Add href
Browse files Browse the repository at this point in the history
  • Loading branch information
theolampert committed Feb 29, 2024
1 parent f1168f2 commit 5589f92
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Sources/ECMASwift/API/URL/URL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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 ?? "" }
Expand Down

0 comments on commit 5589f92

Please sign in to comment.