diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2019-10-02 17:32:51 +0200 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2019-10-02 11:32:51 -0400 |
commit | c920c5f62aba7eee0f6fa70f68f701e204ac1a9c (patch) | |
tree | 3ab590972146e11d75f1ddd296ab1a6aead58906 /cli/lib.rs | |
parent | d32f39f2ec271c7517bbd5113827dc43a7e40641 (diff) |
feat: window.onunload (#3023)
Diffstat (limited to 'cli/lib.rs')
-rw-r--r-- | cli/lib.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cli/lib.rs b/cli/lib.rs index 1e598e262..09134dcdb 100644 --- a/cli/lib.rs +++ b/cli/lib.rs @@ -371,12 +371,17 @@ fn run_script(flags: DenoFlags, argv: Vec<String>) { js_check(worker.execute("denoMain()")); debug!("main_module {}", main_module); + let mut worker_ = worker.clone(); + worker .execute_mod_async(&main_module, false) .and_then(move |()| { js_check(worker.execute("window.dispatchEvent(new Event('load'))")); - worker.then(|result| { + worker.then(move |result| { js_check(result); + js_check( + worker_.execute("window.dispatchEvent(new Event('unload'))"), + ); Ok(()) }) }) |