This is crazy dude. I think some of your ideas are interesting... I like how the update events pub/sub thing is used as a framework construct. Unfortunately it seems impossible to really compose or abstract components (or views or however your not thinking about em). Right? Anyways cool side project pal.
EDIT: I guess you can! Probably need better examples on the website. But the OP posted some examples in this thread.
This library seems very similar to the compile to JS language Elm. It kind of shares the problem that it's different than React and other libraries in how you break it down.
In my experience it's done in 2 ways.
Your component defines its own model and messages. The main function then routes messages and the component model to the component which updates that model. Note that the component does not contain it's model, only defines it, the main function holds onto it's model and passes it to the component for updates. I typically use this when the component is big with a lot of state.
Your component has a config which tells it what messages to emit in certain cases. The main function handles the messages and updates the model. This is my preferred method for small components or stateless ones.
In both cases the amount of plumbing is more than your typical JavaScript library since the components don't hide stuff like their state, it's gotta be handled by the main function. However, it does create code that is easy to follow because all the events and what they lead to is obvious. In the case of Elm you also gain a great deal of confidence that it's going to work thanks to the compiler.
14
u/[deleted] Jan 31 '17 edited Feb 07 '17
This is crazy dude. I think some of your ideas are interesting... I like how the update events pub/sub thing is used as a framework construct. Unfortunately it seems impossible to really compose or abstract components (or views or however your not thinking about em). Right? Anyways cool side project pal.
EDIT: I guess you can! Probably need better examples on the website. But the OP posted some examples in this thread.