about summary refs log tree commit diff stats
path: root/src/html/env.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-09-07 22:20:40 +0200
committerbptato <nincsnevem662@gmail.com>2023-09-07 22:20:40 +0200
commit472145622f03f643090f55d168e021f82a5dd2b6 (patch)
treee798eeae99d9d4264d95d5d84fabdd5ecfa038bf /src/html/env.nim
parent121bb912080570854f5d11683d961f670a8ba749 (diff)
downloadchawan-472145622f03f643090f55d168e021f82a5dd2b6.tar.gz
Add btoa, atob
Diffstat (limited to 'src/html/env.nim')
-rw-r--r--src/html/env.nim7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/html/env.nim b/src/html/env.nim
index 0843c1b6..f48407e3 100644
--- a/src/html/env.nim
+++ b/src/html/env.nim
@@ -10,6 +10,7 @@ import io/promise
 import io/request
 import io/response
 import io/window
+import js/base64
 import js/domexception
 import js/error
 import js/intl
@@ -97,6 +98,12 @@ 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.} =
+  return atob(data)
+
+proc btoa(window: Window, data: string): DOMResult[string] {.jsfunc.} =
+  return btoa(data)
+
 proc addScripting*(window: Window, selector: Selector[int]) =
   let rt = newJSRuntime()
   let ctx = rt.newJSContext()