Just a note as you've made this typo in a few places -- it's "dependency" not "depedency" as you have in your title here as well as Github project description and in your README.md
This is really interesting. I guess the part that confuses me is using the "View" to do traditional controller-esque things. At least in the example, that is how it looked. Would you be able to explain that choice?
Yeah, I think the example itself is not a great pattern. :) If I were to redo that example, or do another example completely, I'd probably move a lot of that logic stuff into the model.
It's possible I'll add a more traditional 'controller' to the mix at some point, but I mostly wanted a similar structure to that of Backbone, without the need for jQuery/underscore.
It's just odd for an MVC framework to not have a 'C'. Generally, your view would just generate HTML, the controller listens for events and responds to them by updating the view and model. Here, your view is taking over that responsibility.
For how small the library is, this is pretty fantastic though. Significantly smaller than Backbone for similar syntax.
Neat project! However, in reality I'd probably just use Backbone if I wanted this kind of architecture because of the wealth of knowledge and support for it on the web.
Yeah, for sure. I mostly started this to see if I can get a Backbone-like MVC without the heavy dependencies of jQuery/underscore/lodash/etc. The DOM selection stuff is also done relying much more heavily on native calls, so it should be much faster than jQuery at most DOM manipulation stuff. It doesn't have much/any browser support hackery built in.
For most of my work, I'll also be sticking to Backbone or something more supported/fully-featured. But I do have tinsy projects here and there that are mobile-focused one-offs that work really well with something like this. I found myself recreating this thing over and over, so I figured I'd just standardize it for me and see if anyone else felt the same need. :)
- Tiny footprint for mobile networks (~5kb minified).
- Extremely fast DOM query/selection engine. No need for jQuery!
- Mobile first - no legacy hackery for ie < 10.
- Great for spinning up small, mobile-specific apps.
To Do
- More useful event delegation. Currently, views must call _setElement() every time they render new DOM elements
-Currently no router for fancy SPA style urls
Installation
npm install ity