about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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 =