about summary refs log tree commit diff stats
path: root/src/html/env.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-10-21 23:34:56 +0200
committerbptato <nincsnevem662@gmail.com>2023-10-21 23:40:24 +0200
commit18008acc141a55449b28c1af487a080c4bbcb355 (patch)
treea81872bfc2e2add0b0c9b6f65f3be15f4d2790c8 /src/html/env.nim
parent69870f3b974e65d61b564b396e01d21cc023e6e9 (diff)
downloadchawan-18008acc141a55449b28c1af487a080c4bbcb355.tar.gz
base64: reduce pointless re-coding using JSString
We now expose some functions from QuickJS to interact with JavaScript
strings without re-encoding them into UTF-8.
Diffstat (limited to 'src/html/env.nim')
-rw-r--r--src/html/env.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/html/env.nim b/src/html/env.nim
index d300400b..0543a60c 100644
--- a/src/html/env.nim
+++ b/src/html/env.nim
@@ -1,6 +1,7 @@
 import selectors
 import streams
 
+import bindings/quickjs
 import display/winattrs
 import html/chadombuilder
 import html/dom
@@ -13,6 +14,7 @@ import js/encoding
 import js/error
 import js/intl
 import js/javascript
+import js/strings
 import js/timeout
 import loader/headers
 import loader/loader
@@ -102,10 +104,10 @@ proc setLocation(window: Window, s: string): Err[JSError]
 proc getWindow(window: Window): Window {.jsuffget: "window".} =
   return window
 
-proc atob(window: Window, data: string): DOMResult[string] {.jsfunc.} =
+proc atob(window: Window, data: string): DOMResult[NarrowString] {.jsfunc.} =
   return atob(data)
 
-proc btoa(window: Window, data: string): DOMResult[string] {.jsfunc.} =
+proc btoa(window: Window, data: JSString): DOMResult[string] {.jsfunc.} =
   return btoa(data)
 
 proc addScripting*(window: Window, selector: Selector[int]) =