Skip to content

Commit

Permalink
Try to fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Sep 17, 2024
1 parent 5ecf970 commit 886e73e
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions web/src/components/worker.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
import init, { RuleSetJs, compare_rulesets_js } from "../../typing_rust_patterns/typing_rust_patterns.js";

await init({});
(async () => {
await init({});

const truncateAt = 300;
const truncateAt = 300;

addEventListener("message", async (event) => {
const data = event.data;
switch (data.type) {
case "compare":
const output = compare_rulesets_js(
RuleSetJs.decode(data.optionsLeft)!,
RuleSetJs.decode(data.optionsRight)!,
data.patDepth,
data.tyDepth,
);
if (output.length > truncateAt) {
const diff = output.length - truncateAt;
output.length = truncateAt;
output.push({ req: `and ${diff} more...` })
}
postMessage({ type: "compare", output });
break;
}
});
addEventListener("message", async (event) => {
const data = event.data;
switch (data.type) {
case "compare":
const output = compare_rulesets_js(
RuleSetJs.decode(data.optionsLeft)!,
RuleSetJs.decode(data.optionsRight)!,
data.patDepth,
data.tyDepth,
);
if (output.length > truncateAt) {
const diff = output.length - truncateAt;
output.length = truncateAt;
output.push({ req: `and ${diff} more...` })
}
postMessage({ type: "compare", output });
break;
}
});

postMessage({ type: "loaded" });
postMessage({ type: "loaded" });
})()

0 comments on commit 886e73e

Please sign in to comment.