const { MessageChannel } = require("worker_threads");

const { port1, port2 } = new MessageChannel();

export function send(message) {
  port2.postMessage(message);
}

export function receiveMessage(cb) {
  port1.on("message", cb);
}
