Niterux
Niterux4w ago

How do I make Deno run code when it is closed out on Windows

According to the documentation there is Deno.addSignalListener but it only handles on Windows when you use CTRL+C or CTRL+BREAK, how do I make it handle all possible closes like Deno.exit or closing it from the task bar?
2 Replies
Niterux
NiteruxOP4w ago
There is deno unload/beforeunload event but it doesn't seem to work when using CTRL+C or when closing out the window, only when I use deno.exit (and I assume also when the script ends naturally) nodejs' process.on('exit') doesn't seem to really do anything for me on deno
Niterux
NiteruxOP3w ago
Is there any way to make it so that Deno runs some code when its closed like this?