about summary refs log tree commit diff stats
path: root/src/display/client.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-07-01 19:26:32 +0200
committerbptato <nincsnevem662@gmail.com>2023-07-01 19:57:54 +0200
commit2b10a9b7f61d58157f85c93e8e7b18b1e01e4b79 (patch)
treea6c544e5c0e49578d847985945448344540a9f7f /src/display/client.nim
parentef136ac44db26074bf9528f17dee764f731ed4eb (diff)
downloadchawan-2b10a9b7f61d58157f85c93e8e7b18b1e01e4b79.tar.gz
use =destroy instead of finalizers
This should help with moving to ORC in the future. (Also, finalizers
do not work very well in the first place.)
Diffstat (limited to 'src/display/client.nim')
-rw-r--r--src/display/client.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/display/client.nim b/src/display/client.nim
index 721af4a0..3f4039df 100644
--- a/src/display/client.nim
+++ b/src/display/client.nim
@@ -77,6 +77,9 @@ type
     ibuf: string
     tty: File
 
+jsDestructor(Client)
+jsDestructor(Console)
+
 proc readChar(console: Console): char =
   if console.ibuf == "":
     try:
@@ -86,7 +89,7 @@ proc readChar(console: Console): char =
   result = console.ibuf[0]
   console.ibuf = console.ibuf.substr(1)
 
-proc `=destroy`(client: var ClientObj) =
+proc finalize(client: Client) {.jsfin.} =
   if client.jsctx != nil:
     free(client.jsctx)
   if client.jsrt != nil: