web/remux: check if env is browser before adding listeners
This commit is contained in:
parent
21832005e2
commit
80e32fc0c0
1 changed files with 3 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
<script lang="ts">
|
||||
import mime from "mime";
|
||||
import LibAVWrapper from "$lib/libav";
|
||||
import { browser } from "$app/environment";
|
||||
import { beforeNavigate } from '$app/navigation';
|
||||
|
||||
import { openURL } from "$lib/download";
|
||||
|
@ -151,9 +152,9 @@
|
|||
}
|
||||
})
|
||||
|
||||
$: if (processing) {
|
||||
$: if (browser && processing) {
|
||||
window.addEventListener("beforeunload", beforeUnloadHandler);
|
||||
} else {
|
||||
} else if (browser) {
|
||||
window.removeEventListener("beforeunload", beforeUnloadHandler);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue