Skip to content

Commit

Permalink
fix: fix preload logic
Browse files Browse the repository at this point in the history
  • Loading branch information
congzhangzh committed Nov 2, 2024
1 parent 85be3ec commit ff44d58
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/ffi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,14 @@ export function unload() {

// Automatically run the preload if we're on windows and on the main thread.
if (Deno.build.os === "windows") {
if (self === globalThis) {
await preload();
} else if (!await checkForWebView2Loader()) {
throw new Error(
"WebView2Loader.dll does not exist! Make sure to run preload() from the main thread.",
);
if (!await checkForWebView2Loader()) {
if (self === globalThis) {
await preload();
} else {
throw new Error(
"WebView2Loader.dll does not exist! Make sure to run preload() from the main thread.",
);
}
}
}

Expand Down

0 comments on commit ff44d58

Please sign in to comment.