Chapter 3

Backbone.js

Backbone gives your app structure. It provides a sensible framework that stores your app's data, relaying that data to the user as onscreen content. It can also manage syncing that data with the database or local storage. In this chapter, you find out how to store your app's data using Backbone models and collections. You then learn how to tie that data to the content that gets displayed to the user. Any changes in the content will be automatically updated on the screen. Additionally, you discover how to sync Backbone data with a database server, allowing you to save and fetch the data and create a state that is persistent across different sessions.

This chapter also covers how to tie different URLs to different states of your app, enabling you to build navigation and bookmarking support for your app. Finally, you find out how to set up custom handlers for any changes in your data, and also how to manipulate and sort collections.

Getting Started with Backbone

Although Backbone isn't necessarily easy to learn, it's certainly worth the effort, and if you already have experience with a back-end Model-view-controller (MVC), getting started with Backbone will be a lot easier. That's because the concepts of Backbone are harder to grasp than the actual implementation and usage.

What Is Backbone?

Backbone is a JavaScript MVC framework, which brings all the concepts of an MVC pattern commonly found on server side frameworks, to the front end. Basically, it allows ...

Get JavaScript Programming: Pushing the Limits 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.