0

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

5
  • Every web application needs some serverside software? Or do you look for MVC frameworks where also the serverside part is written in JS? Commented Oct 11, 2012 at 19:42
  • Of course they do, but I also found a framework requiring certain scripts on the server Commented Oct 11, 2012 at 19:47
  • For example, Backbone does not require special server softwae (only the requests and responses must be JSON) Commented Oct 11, 2012 at 19:48
  • 1
    Take a look at angularjs for a good MVC framework. Also there's knockoutJS for an MVVM approach. Although knockout doesn't include its own templating system IIRC. Commented Oct 11, 2012 at 19:48
  • I really liked AngualarJS but it requires compilation :/ Thanks, I will read through :) Commented Oct 11, 2012 at 19:50

1 Answer 1

1

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:

  • Models in js/myapp/models/
  • Views in js/myapp/views/
  • etc..

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.