2022-05-18 00:04:37 +09:00
|
|
|
import "../assets/polyfill_performance.js";
|
|
|
|
import "../assets/wasm_exec.js";
|
|
|
|
import mod from "./dist/app.wasm";
|
|
|
|
|
|
|
|
const go = new Go();
|
|
|
|
|
2023-02-11 12:37:38 +09:00
|
|
|
const readyPromise = new Promise((resolve) => {
|
|
|
|
globalThis.ready = resolve;
|
|
|
|
});
|
|
|
|
|
2022-05-18 00:04:37 +09:00
|
|
|
const load = WebAssembly.instantiate(mod, go.importObject).then((instance) => {
|
|
|
|
go.run(instance);
|
|
|
|
return instance;
|
|
|
|
});
|
|
|
|
|
2023-02-11 12:37:38 +09:00
|
|
|
export default {
|
|
|
|
async fetch(req, env, ctx) {
|
|
|
|
await load;
|
|
|
|
await readyPromise;
|
|
|
|
return handleRequest(req, { env, ctx });
|
|
|
|
}
|
2022-05-29 11:23:22 +09:00
|
|
|
}
|