keajs / kea

Batteries Included State Management for React

Home Page:https://keajs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

webworker support

kesavkolla opened this issue · comments

Since kea is fully a logical layer is it possible to run the kea entirely from a worker? This makes kea completely separated from react UI thread.

Hey, it's theoretically possible, but it won't give you any real world benefits. Web worker run in a separate thread and only communicate via message passing. This adds enough overhead to basically neglect any performance wins you might get.

Search for "redux webworker" to find examples of people trying this in the past, such as this one (medium link, open incognito to pass paywall)

Web worker may be a bad use case. I used that use case to present complete decoupleness. Basically logic layer is not tied to react UI to me that is power in itself. In that case the same logic layer can be plugged to other UI layers like mobile in react native or even other UI in vuejs etc... The interaction between UI to logic layer is all via events and message passing.

Indeed, Kea can be used totally without React. Here are some examples of using logics directly: https://kea.js.org/docs/guide/advanced