aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-06-29 19:03:08 +0200
committerbptato <nincsnevem662@gmail.com>2023-06-29 19:03:08 +0200
commit6aa9ec1c15a3a4b17f6283d605dd116e62d7ce64 (patch)
tree9fa4ca774317a83f13cab4e07a81efbf5e35fc31
parent1499a0757a8877355a2c5983cbe63c16837a83f8 (diff)
downloadchawan-6aa9ec1c15a3a4b17f6283d605dd116e62d7ce64.tar.gz
Add assign, replace, reload to location
Just stubs: none of them actually work
-rw-r--r--src/html/dom.nim14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim
index bfb5581f..727eab77 100644
--- a/src/html/dom.nim
+++ b/src/html/dom.nim
@@ -1122,11 +1122,23 @@ proc setLocation*(document: Document, s: string): Err[DOMException]
func href(location: Location): string {.jsfget.} =
return location.url.serialize()
-proc href(location: Location, s: string): Err[DOMException] {.jsfset.} =
+proc setHref(location: Location, s: string): Err[DOMException]
+ {.jsfset: "href".} =
if location.document == nil:
return ok()
return location.document.setLocation(s)
+proc assign(location: Location, s: string): Err[DOMException] {.jsfunc.} =
+ location.setHref(s)
+
+proc replace(location: Location, s: string): Err[DOMException] {.jsfunc.} =
+ location.setHref(s)
+
+proc reload(location: Location) {.jsfunc.} =
+ if location.document == nil:
+ return
+ location.document.window.navigate(location.url)
+
func origin(location: Location): string {.jsfget.} =
return location.url.origin