Detect when the event loop is finished in a Worker
When Deno executes a script, once the script is finalized, the process is terminated. Is there any way to detect that inside a worker? I know I can call
self.close() to terminate the worker, but I want to wait until all timers are closed (unawaited promises, etc) and the event loop is clean. Deno does it automatically in the main script, but I don't know if there's a way to detect this state inside a Worker.