securityos/node_modules/comlink/docs/examples/06-node-example/main.mjs

12 lines
328 B
JavaScript
Raw Normal View History

2024-09-06 15:32:35 +00:00
import { Worker } from "worker_threads";
import * as Comlink from "../../../dist/esm/comlink.mjs";
import nodeEndpoint from "../../../dist/esm/node-adapter.mjs";
async function init() {
const worker = new Worker("./worker.mjs");
const api = Comlink.wrap(nodeEndpoint(worker));
console.log(await api.doMath());
}
init();