I recently made use of Backbone as the MVC-framework for the single page web application we developed in my company. I found out that Backbone lacks some features that are quite important for larger applications (e.g. ui bindings, module-concept as in CommmonJS) poor model-definitions).
During my research on JavaScript-MVC-frameworks that would fill those gaps I only found frameworks requiring additional server software, compiling and so on.
Aren’t there any pure-JS-MVC-frameworks?
Thanks in advance 🙂
Best wishes
Leo
As far as modules are concerned:
You could introduce modules to a Backbone-based application fairly simply. I would recommend AMD over CommonJS (using RequireJS) as the module pattern to use. You have the option to build a “build” system for it, but don’t need to.
Something like the following could be the situation:
js/myapp/models/js/myapp/views/Where each model/view is wrapped in a call to RequireJS’s
define()function.Inside of your main script, you could require the views/models using RequireJS’s
require()function.UI Bindings:
Using Backbone by itself: they’re not necessarily “bindings”, but you can listen to model change events in your views and update the spots in your views where the model values are displayed.
Using a plugin, like backbone.modelBinding you can get closer to real binding.