-
I'd like to know if there would be any any contraindication in using XState inside workers. What i need to do is to deploy state machines on a different server than my main application. I thought using workers would fit my need and I was wondering if someone has already experimented it. I did some tests on my own and it seems to work pretty well. I couldn't use the inspector though (any idea ?). |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You'd have to write the inspector using some other way - by proxying events through your main window because webworkers have no APIs that would allow us to start the inspector automatically. As to using XState with webworkers - no reasons why you wouldn't be able to do this :) |
Beta Was this translation helpful? Give feedback.
-
Let us know how well it works in performance please? I thought about putting XState in a worker yesterday, but I don't think the extra steps of communicating between the worker & main JS thread is worth it. Unless you have much more things going on in the worker anyway, or are using Cloudflare Workers. |
Beta Was this translation helpful? Give feedback.
You'd have to write the inspector using some other way - by proxying events through your main window because webworkers have no APIs that would allow us to start the inspector automatically.
As to using XState with webworkers - no reasons why you wouldn't be able to do this :)