Book Image

Backbone.js Essentials

By : Jeremy Walker
Book Image

Backbone.js Essentials

By: Jeremy Walker

Overview of this book

<p>This book offers insight into creating and maintaining dynamic Backbone.js web applications. It delves into the the fundamentals of Backbone.js and helps you achieve mastery of the Backbone library.</p> <p>Starting with Models and Collections, you'll learn how to simplify client-side data management and easily transmit data to and from your server. Next, you'll learn to use Views and Routers to facilitate DOM manipulation and URL control so that your visitors can navigate your entire site without ever leaving the first HTML page. Finally, you'll learn how to combine those building blocks with other tools to achieve high-performance, testable, and maintainable web applications.</p>
Table of Contents (20 chapters)
Backbone.js Essentials
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Underscore methods


Collections, such as Models, have a number of methods inherited from Underscore, but Collections actually have a lot more methods than Models...28 methods to be exact. We can't possibly cover all these methods in detail here, so I'll just provide a quick summary of what each method does and then explore a few of the more important ones in depth.

Note that just as with the Underscore methods on Model, some of these methods operate on the attributes of the Models inside the Collection rather than on the Collection or Models themselves. At the same time, however, all the methods that return multiple results return plain old JavaScript arrays, not new Collections. This is done for performance reasons and shouldn't be an issue because if you need those results as a Collection, you can simply create a new one and pass in the results array.

Name

What it does

each

This iterates over every Model in the Collection

map

This returns an array of values by transforming every...