about summary refs log tree commit diff stats
path: root/src/display/client.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-08-20 16:53:14 +0200
committerbptato <nincsnevem662@gmail.com>2023-08-20 16:54:20 +0200
commitb75466f2f974e1a0c3e59b4cdffae668ba1d86df (patch)
tree62e0c4d87f1851fd316603919805a5c69aa401d7 /src/display/client.nim
parent230ad7876ed5f8f26dce02db0e3528a5539150f4 (diff)
downloadchawan-b75466f2f974e1a0c3e59b4cdffae668ba1d86df.tar.gz
client: make `client.client' a getter
This way we do not need the ugly getProperty call.
Diffstat (limited to 'src/display/client.nim')
-rw-r--r--src/display/client.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/display/client.nim b/src/display/client.nim
index a993fe9f..4d0d59f2 100644
--- a/src/display/client.nim
+++ b/src/display/client.nim
@@ -585,6 +585,9 @@ proc addJSModules(client: Client, ctx: JSContext) =
   ctx.addPagerModule()
   ctx.addContainerModule()
 
+func getClient(client: Client): Client {.jsfget: "client".} =
+  return client
+
 proc newClient*(config: Config, forkserver: ForkServer, mainproc: Pid): Client =
   setControlCHook(proc() {.noconv.} = quit(1))
   let jsrt = newJSRuntime()
@@ -608,7 +611,6 @@ proc newClient*(config: Config, forkserver: ForkServer, mainproc: Pid): Client =
   var global = JS_GetGlobalObject(jsctx)
   jsctx.registerType(Client, asglobal = true)
   setGlobal(jsctx, global, client)
-  jsctx.setProperty(global, "client", global)
   JS_FreeValue(jsctx, global)
   jsctx.registerType(Console)
   client.addJSModules(jsctx)