diff options
author | bptato <nincsnevem662@gmail.com> | 2023-09-07 22:20:40 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-09-07 22:20:40 +0200 |
commit | 472145622f03f643090f55d168e021f82a5dd2b6 (patch) | |
tree | e798eeae99d9d4264d95d5d84fabdd5ecfa038bf /src/html/env.nim | |
parent | 121bb912080570854f5d11683d961f670a8ba749 (diff) | |
download | chawan-472145622f03f643090f55d168e021f82a5dd2b6.tar.gz |
Add btoa, atob
Diffstat (limited to 'src/html/env.nim')
-rw-r--r-- | src/html/env.nim | 7 |
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() |