about summary refs log tree commit diff stats
path: root/src/display/client.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-04-30 12:19:24 +0200
committerbptato <nincsnevem662@gmail.com>2023-04-30 12:19:24 +0200
commita02c408f933aea6f405ed3c64ab151b01b33ae9e (patch)
tree4946f6b13da782a92a1ecc0f03402abacf2614b3 /src/display/client.nim
parent05b64a1d8fa95381d756231f665c0b8c79787b67 (diff)
downloadchawan-a02c408f933aea6f405ed3c64ab151b01b33ae9e.tar.gz
WIP fetch
Diffstat (limited to 'src/display/client.nim')
-rw-r--r--src/display/client.nim4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/display/client.nim b/src/display/client.nim
index 38a868dc..59557f36 100644
--- a/src/display/client.nim
+++ b/src/display/client.nim
@@ -86,6 +86,9 @@ proc `=destroy`(client: var ClientObj) =
 proc doRequest(client: Client, req: Request): Response {.jsfunc.} =
   return client.loader.doRequest(req)
 
+proc fetch(client: Client, req: Request): Promise[Response] {.jsfunc.} =
+  return client.loader.fetch(req)
+
 proc interruptHandler(rt: JSRuntime, opaque: pointer): int {.cdecl.} =
   let client = cast[Client](opaque)
   if client.console == nil or client.console.tty == nil: return
@@ -465,6 +468,7 @@ proc launchClient*(client: Client, pages: seq[string], ctype: Option[string], du
       dump = true
   client.ssock = initServerSocket(false)
   client.selector = newSelector[Container]()
+  client.loader.registerFun = proc(fd: int) = client.selector.registerHandle(fd, {Read}, nil)
   client.selector.registerHandle(int(client.dispatcher.forkserver.estream.fd), {Read}, nil)
   client.pager.launchPager(tty)
   client.console = newConsole(client.pager, tty)