mirror of
https://github.com/denoland/deno.git
synced 2025-09-25 11:49:11 +00:00
feat: window.onunload (#3023)
This commit is contained in:
parent
d32f39f2ec
commit
c920c5f62a
9 changed files with 126 additions and 20 deletions
|
@ -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(())
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue