about summary refs log tree commit diff stats
path: root/src/display/client.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-06-11 22:22:04 +0200
committerbptato <nincsnevem662@gmail.com>2023-06-11 22:22:04 +0200
commitd7e9633303952f82b0741391d16b0f958f95d3e5 (patch)
tree5afdbcc49ab54046ec2bda8d932a2be2fb9383ec /src/display/client.nim
parent3a18dbf932ed9d9595099c59d4e01d2915734e36 (diff)
downloadchawan-d7e9633303952f82b0741391d16b0f958f95d3e5.tar.gz
Add readBlob, fix WebFile serialization
It's still kind of a mess, but it kind of works?
Diffstat (limited to 'src/display/client.nim')
-rw-r--r--src/display/client.nim8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/display/client.nim b/src/display/client.nim
index 98b8d7b7..d3878e49 100644
--- a/src/display/client.nim
+++ b/src/display/client.nim
@@ -15,8 +15,8 @@ import std/exitprocs
 
 import bindings/quickjs
 import buffer/container
-import css/sheet
 import config/config
+import css/sheet
 import data/charset
 import display/pager
 import display/term
@@ -409,6 +409,12 @@ proc clientLoadJSModule(ctx: JSContext, module_name: cstring,
     JS_ThrowTypeError(ctx, "Failed to open file %s", module_name)
     return nil
 
+proc readBlob(client: Client, path: string): Option[WebFile] {.jsfunc.} =
+  try:
+    return some(newWebFile(path))
+  except IOError:
+    discard
+
 #TODO this is dumb
 proc readFile(client: Client, path: string): string {.jsfunc.} =
   try: