about summary refs log tree commit diff stats
path: root/src/local/client.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-07-16 21:30:30 +0200
committerbptato <nincsnevem662@gmail.com>2024-07-16 21:36:27 +0200
commitc3b6bc8f93c6d35d5e8e9752abe6a736423497e8 (patch)
tree8b52c74503793d140f93b0d4ebbf88ee37c153e3 /src/local/client.nim
parentf928f3abd18fb63781b9d2cba47a8796348f9b1f (diff)
downloadchawan-c3b6bc8f93c6d35d5e8e9752abe6a736423497e8.tar.gz
timeout: simplify, misc fixes
Merge timeout & interval code paths.

This fixes clearTimeout not clearing intervals.
Diffstat (limited to 'src/local/client.nim')
-rw-r--r--src/local/client.nim14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/local/client.nim b/src/local/client.nim
index a852d8cd..bdb796a7 100644
--- a/src/local/client.nim
+++ b/src/local/client.nim
@@ -360,19 +360,19 @@ proc input(client: Client): EmptyPromise =
     p.resolve()
   return p
 
-proc setTimeout[T: JSValue|string](client: Client; handler: T;
-    timeout = 0i32): int32 {.jsfunc.} =
-  return client.timeouts.setTimeout(handler, timeout)
+proc setTimeout(client: Client; handler: JSValue; timeout = 0i32): int32
+    {.jsfunc.} =
+  return client.timeouts.setTimeout(ttTimeout, handler, timeout)
 
-proc setInterval[T: JSValue|string](client: Client; handler: T;
-    interval = 0i32): int32 {.jsfunc.} =
-  return client.timeouts.setInterval(handler, interval)
+proc setInterval(client: Client; handler: JSValue; interval = 0i32): int32
+    {.jsfunc.} =
+  return client.timeouts.setTimeout(ttInterval, handler, interval)
 
 proc clearTimeout(client: Client; id: int32) {.jsfunc.} =
   client.timeouts.clearTimeout(id)
 
 proc clearInterval(client: Client; id: int32) {.jsfunc.} =
-  client.timeouts.clearInterval(id)
+  client.clearTimeout(id)
 
 let SIGWINCH {.importc, header: "<signal.h>", nodecl.}: cint