From 18008acc141a55449b28c1af487a080c4bbcb355 Mon Sep 17 00:00:00 2001 From: bptato Date: Sat, 21 Oct 2023 23:34:56 +0200 Subject: 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. --- src/html/env.nim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/html/env.nim') 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]) = -- cgit 1.4.1-2-gfad0