Chapter 13. The JavascriptMVC Library

Justin Meyer, the author of JavaScriptMVC, kindly contributed this chapter

JavaScriptMVC (JMVC) is an open source jQuery-based JavaScript framework. It is nearly a comprehensive (holistic) frontend development framework, packaging utilities for testing, dependency management, documentation, and a host of useful jQuery plug-ins.

Yet every part of JavaScriptMVC can be used without every other part, making the library lightweight. Its class, model, view, and controller combined are only 7k minified and compressed, yet even they can be used independently. JavaScriptMVC’s independence lets you start small and scale to meet the challenges of the most complex applications on the Web.

This chapter covers JavaScriptMVC’s $.Class, $.Model, $.View, and $.Controller. The following describes each component:

$.Class

The JavaScript-based class system

$.Model

The traditional model layer

$.View

The client-side template system

$.Controller

The jQuery widget factory

JavaScriptMVC’s naming conventions deviate slightly from the traditional Model-View-Controller design pattern. For example, $.Controller is used to create traditional view controls, like pagination buttons and lists, as well as traditional controllers that coordinate between the traditional views and models.

Setup

JavaScriptMVC can be used as a single download that includes the entire framework. But since this chapter covers only the MVC parts, go to the download builder; check Controller, Model, and View’s ...

Get JavaScript Web Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.