From b75466f2f974e1a0c3e59b4cdffae668ba1d86df Mon Sep 17 00:00:00 2001 From: bptato Date: Sun, 20 Aug 2023 16:53:14 +0200 Subject: client: make `client.client' a getter This way we do not need the ugly getProperty call. --- src/display/client.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') 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) -- cgit