MVC approach for JavaScript
I am searching for a decent framework for organizing my Javascript, jQuery assisted code according to MVCS micro-architecture.
I did some research on JavaScriptMVC, and though it looks like a robust product, I'm afraid it's a bit of an "overkill" for my needs, and since it's poorly documented it will take me hours to exclude only the parts of it that I can utilize.
What I really search for is something elegant like a jQuery-PureMVC port (which as far as I know does n开发者_如何学Pythonot exist) or Robotlegs (for those who are familiar with this AS3 framework). In other words: I look for a light and simple framework that will allow me to easily manage the business logic surrounding my many existing custom jQuery UI Widgets.
Any recommendations?
Try backbone.js
Backbone supplies structure to JavaScript-heavy applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing application over a RESTful JSON interface.
It's lightweight and allows you to plugin into the abstractions easily. It was also designed to not have a UI attached to it so you can plug in jQuery or whatever other library you intend to use.
Have a quick look at backbone.js, a companion project to underscore.js.
It is a fairly small but powerful framework, which lets you build things from the ground up.
Here a brief tutorial on how to develop a single page app with Backbone.js.
精彩评论