Skip to content

Commit ff44d58

Browse files
committed
fix: fix preload logic
1 parent 85be3ec commit ff44d58

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/ffi.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,14 @@ export function unload() {
8888

8989
// Automatically run the preload if we're on windows and on the main thread.
9090
if (Deno.build.os === "windows") {
91-
if (self === globalThis) {
92-
await preload();
93-
} else if (!await checkForWebView2Loader()) {
94-
throw new Error(
95-
"WebView2Loader.dll does not exist! Make sure to run preload() from the main thread.",
96-
);
91+
if (!await checkForWebView2Loader()) {
92+
if (self === globalThis) {
93+
await preload();
94+
} else {
95+
throw new Error(
96+
"WebView2Loader.dll does not exist! Make sure to run preload() from the main thread.",
97+
);
98+
}
9799
}
98100
}
99101

0 commit comments

Comments
 (0)