diff options
author | bptato <nincsnevem662@gmail.com> | 2023-09-01 21:50:24 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-09-01 21:53:44 +0200 |
commit | 52632e4427eca500e3bf6394852db8925e3af6d2 (patch) | |
tree | 47ef434301e08411480584462f105c68e1ef9629 | |
parent | b57be7b89d656d1eda13f464b41373c2535e106f (diff) | |
download | chawan-52632e4427eca500e3bf6394852db8925e3af6d2.tar.gz |
buffer: run JS jobs on connected/read/error
Not exactly the cleanest solution, but it should work for now. (Ideally it would only be called once after the select IF any of the three occurred on a fetchable file descriptor.)
-rw-r--r-- | src/buffer/buffer.nim | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/buffer/buffer.nim b/src/buffer/buffer.nim index c87a6181..5cbf5893 100644 --- a/src/buffer/buffer.nim +++ b/src/buffer/buffer.nim @@ -1394,8 +1394,12 @@ proc handleRead(buffer: Buffer, fd: int) = buffer.onload() elif fd in buffer.loader.connecting: buffer.loader.onConnected(fd) + if buffer.config.scripting: + buffer.window.runJSJobs() elif fd in buffer.loader.ongoing: buffer.loader.onRead(fd) + if buffer.config.scripting: + buffer.window.runJSJobs() elif fd in buffer.loader.unregistered: discard # ignore else: assert false @@ -1411,6 +1415,8 @@ proc handleError(buffer: Buffer, fd: int, err: OSErrorCode) = assert false, $fd & ": " & $err elif fd in buffer.loader.ongoing: buffer.loader.onError(fd) + if buffer.config.scripting: + buffer.window.runJSJobs() elif fd in buffer.loader.unregistered: discard # ignore else: |