2 ms·
Another good guide to mvc with js is this one https://github.com/madhadron/mvc_for_the_web https://github.com/madhadron/mvc_for_the_web The neat thing is that
by dsego 6y ago
Another good guide to mvc with js is this one https://github.com/madhadron/mvc_for_the_web https://github.com/madhadron/mvc_for_the_web
The neat thing is that it starts from scratch and adds things, like pub/sub, then models, controllers and so on.
- morrvs 6y agoIt does start from scratch but it (re-)invents a whole lot of general-purpose code, in effect making up a framework/library, which was an explicit non-goal for the case study (because there are good ones already).
- dsego 6y agoI didn't have time before to go through your case study. But after looking at it for a bit, it doesn't look that much different from the mvc example I linked. It seems that you are leveraging the built-in event system for observers and using the dom for referencing your components. Personally, I don't feel that mvc for the web is inventing a whole lot more, just patterns and some utilities. Having events that bubble from the child component up to the app component is an interesting approach. It simplifies the code by not having to pass controllers into views, but makes the child components less reusable in other contexts. Btw, this structure also reminds me of backbone(1) and that riotjs 1kb blog post from ages ago(2). I love the effort and thank you for making it. (1) https://backbonejs.org/#View https://backbonejs.org/#View (2) https://muut.com/blog/technology/riotjs-the-1kb-mvp-framework.html https://muut.com/blog/technology/riotjs-the-1kb-mvp-framewor....