Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyan-dfinity committed Sep 3, 2024
1 parent 7d359a8 commit 328c82f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 0 additions & 3 deletions src/workers/file.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as Comlink from "comlink";
declare var Motoko: any;

interface ExtraFile {
Expand Down Expand Up @@ -157,5 +156,3 @@ async function fetchFromGithub(
return files;
});
}

Comlink.expose({ fetchPackage, fetchGithub, saveWorkplaceToMotoko });
10 changes: 9 additions & 1 deletion src/workers/moc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as Comlink from "comlink";
import { loadMoc } from "./mocShim.js";
import { fetchPackage, fetchGithub, saveWorkplaceToMotoko } from "./file";
import { pow } from "./pow";

let Motoko: any;

Expand Down Expand Up @@ -58,7 +60,13 @@ loadMoc()
if (Motoko) {
globalThis.Motoko = Motoko;
Motoko.saveFile("Main.mo", "");
Comlink.expose({ Moc });
Comlink.expose({
Moc,
fetchPackage,
fetchGithub,
saveWorkplaceToMotoko,
pow,
});
} else {
console.error("Failed to initialize Motoko");
}
Expand Down
4 changes: 0 additions & 4 deletions src/workers/pow.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as Comlink from "comlink";

const DOMAIN = "motoko-playground";

export function pow(timestamp: bigint) {
Expand Down Expand Up @@ -33,5 +31,3 @@ function motokoHash(message: string): number {
function hashOk(hash: number): boolean {
return (hash & 0xc0000000) === 0;
}

Comlink.expose({ pow });

0 comments on commit 328c82f

Please sign in to comment.