developit / preact-worker-demo

Demo of preact rendering an entire app in a Web Worker.
https://preact-worker-demo.surge.sh
226 stars 16 forks source link

How to redo this with Comlink? #2

Open sdykae opened 4 years ago

sdykae commented 4 years ago

Since comlink achive to do the same with redux in a friendly way. I want to do the same with the preact dom, How can I achive this ;c. I'm unable to understand the requirements for this. Can you guide me with the very basic?

Do I need undom?

marvinhagemeister commented 4 years ago

You need to chose pretty much the same approach as in this repo. Preact uses a subset of the DOM-API which needs to be mocked inside your worker. These mocks will need to pass a message to the main thread and the main thread will need something that responds to those messages and apply it to the DOM.