Skip to content

Commit

Permalink
fix: fix preload logic (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
congzhangzh authored Nov 25, 2024
1 parent 85be3ec commit 84671ea
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 84671ea

Please sign in to comment.