Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复了mcla_worker.js的位置不对, 导致无法加载的问题 #161

Merged
merged 6 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: 🔧 Check Code Format
run: |
yarn docs:lint && exit 0
echo "请执行 `pnpm run docs:format` 以格式化代码"
echo 'Error: 请执行 `pnpm run docs:format` 以格式化代码' 1>&2
exit 1

- name: 🌌 Build VitePress Docs
Expand Down
12 changes: 10 additions & 2 deletions docs/.vitepress/analyzers/mcla.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ class MCLAWorker implements MCLAAPI {
worker.onmessage = (event) => this.onmsg(event)
worker.onerror = (event) => {
console.error("Error in MCLA Worker:", event)
for (const [, reject] of this.pendings.values()) {
reject("Error inside MCLAWorker")
}
this.pendings.clear()
}
this.pendings = new Map()
this.registry = new FinalizationRegistry((ptr: number) => {
Expand Down Expand Up @@ -258,7 +262,7 @@ class MCLAWorker implements MCLAAPI {

async function loadMCLAWorker(): Promise<MCLAAPI> {
return MCLAWorker.createFromWorker(
new Worker("/src/mcla_worker.js", {
new Worker("/scripts/mcla_worker.js", {
type: "classic",
}),
)
Expand All @@ -274,7 +278,11 @@ interface containsMCLAIns {

async function loadMCLA(): Promise<MCLAAPI> {
if (window.Worker) {
return loadMCLAWorker()
try {
return loadMCLAWorker()
} catch (e) {
// if cannot load by worker, try load inside the window
}
}

await import(GO_WASM_EXEC_URL /* @vite-ignore */) // set variable `window.Go`
Expand Down
File renamed without changes.