// public/miner.worker.js

const emscriptenWorker = new Worker('/emscripten-worker.js?v=' + new Date().getTime());

// Forward messages from main thread to emscriptenWorker
self.addEventListener('message', (event) => {
  emscriptenWorker.postMessage(event.data);
});

// Forward messages from emscriptenWorker to main thread
emscriptenWorker.addEventListener('message', (event) => {
  self.postMessage(event.data);
});

self.postMessage({ type: 'miner-initialized' }); // Notify main thread that miner is ready