shared_worker.html 365 B

12345678910111213
  1. <html>
  2. <body>
  3. <script type="text/javascript" charset="utf-8">
  4. const {ipcRenderer} = require('electron')
  5. // Pass a random parameter to create independent worker.
  6. let worker = new SharedWorker(`../workers/shared_worker_node.js?a={Math.random()}`)
  7. worker.port.onmessage = function (event) {
  8. ipcRenderer.sendToHost(event.data)
  9. }
  10. </script>
  11. </body>
  12. </html>