summaryrefslogtreecommitdiff
path: root/cli/standalone.rs
diff options
context:
space:
mode:
authorColin Ihrig <cjihrig@gmail.com>2022-06-28 10:49:30 -0400
committerGitHub <noreply@github.com>2022-06-28 10:49:30 -0400
commit0f6a5c5fc24e8dc9125c5c536c8547a86ca87b15 (patch)
tree41538ee1df06dc80d60e49ed50177f99ba8dc297 /cli/standalone.rs
parentab11b45d1d2678cfea2217ac72fc24317eef777d (diff)
feat(web): add beforeunload event (#14830)
This commit adds the 'beforeunload' event. Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'cli/standalone.rs')
-rw-r--r--cli/standalone.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/cli/standalone.rs b/cli/standalone.rs
index d66eb7694..50baf70ea 100644
--- a/cli/standalone.rs
+++ b/cli/standalone.rs
@@ -316,7 +316,14 @@ pub async fn run(
);
worker.execute_main_module(main_module).await?;
worker.dispatch_load_event(&located_script_name!())?;
- worker.run_event_loop(true).await?;
+
+ loop {
+ worker.run_event_loop(false).await?;
+ if !worker.dispatch_beforeunload_event(&located_script_name!())? {
+ break;
+ }
+ }
+
worker.dispatch_unload_event(&located_script_name!())?;
std::process::exit(0);
}