aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2025-02-20 18:39:20 +0100
committerbptato <nincsnevem662@gmail.com>2025-02-20 18:39:20 +0100
commit7342f552bffb87acc184a959b28559fae03c9782 (patch)
tree62ddf85e554e3e4c3386ca58c0c0c82913c94207
parent10e291490843770c3818da97c34cc148acca8c5a (diff)
downloadchawan-7342f552bffb87acc184a959b28559fae03c9782.tar.gz
env: shim pushState
not standard-compliant, but better than nothing
-rw-r--r--src/html/env.nim8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/html/env.nim b/src/html/env.nim
index f55817c4..6c38fdd3 100644
--- a/src/html/env.nim
+++ b/src/html/env.nim
@@ -105,12 +105,20 @@ proc height(ctx: JSContext; screen: var Screen): int {.jsfget.} =
proc colorDepth(screen: var Screen): int {.jsfget.} = 24
proc pixelDepth(screen: var Screen): int {.jsfget.} = screen.colorDepth
+proc setLocation(window: Window; s: string): Err[JSError]
+
# History
func length(history: var History): uint32 {.jsfget.} = 1
func state(history: var History): JSValue {.jsfget.} = JS_NULL
func go(history: var History) {.jsfunc.} = discard
func back(history: var History) {.jsfunc.} = discard
func forward(history: var History) {.jsfunc.} = discard
+proc pushState(ctx: JSContext; history: var History;
+ data, unused: JSValue; s: string): JSResult[void] {.jsfunc.} =
+ let window = ctx.getWindow()
+ if window != nil:
+ return window.setLocation(s)
+ return ok()
# Storage
func find(this: Storage; key: string): int =