summaryrefslogtreecommitdiff
path: root/runtime/js/30_os.js
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/js/30_os.js')
-rw-r--r--runtime/js/30_os.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/runtime/js/30_os.js b/runtime/js/30_os.js
index 74af82124..1d700b561 100644
--- a/runtime/js/30_os.js
+++ b/runtime/js/30_os.js
@@ -24,6 +24,9 @@
}
function exit(code = 0) {
+ // Invokes the `unload` hooks before exiting
+ // ref: https://github.com/denoland/deno/issues/3603
+ window.dispatchEvent(new Event("unload"));
core.jsonOpSync("op_exit", { code });
throw new Error("Code not reachable");
}