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

11 lines
263 B
JavaScript

import { parentPort } from "worker_threads";
import * as Comlink from "../../../dist/esm/comlink.mjs";
import nodeEndpoint from "../../../dist/esm/node-adapter.mjs";
const api = {
doMath() {
return 4;
},
};
Comlink.expose(api, nodeEndpoint(parentPort));