summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2021-01-12 19:32:58 +0900
committerGitHub <noreply@github.com>2021-01-12 05:32:58 -0500
commitfd56fa89f36016a816450cd0e8df5853c66d170c (patch)
tree7d21163bf2a1c5a4d5f73f998afbaa2e4c2b7a91 /runtime/js
parent5c6ab75de1e5817df3620a5cdd85eba748b2a8a6 (diff)
fix(cli): dispatch unload on exit (#9088)
Diffstat (limited to 'runtime/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");
}