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

Introducing Underscore


In addition to jQuery, Backbone also requires one library called Underscore. Underscore was written by Jeremy Ashkenas (the creator of Backbone), and many of its functions are relevant to the topics we've discussed so far. Because Underscore is required by Backbone, you'll already have it available to you if you use Backbone. All of these functions can be accessed via the _ character (similar to how jQuery functions are accessed via the $ character).

As we discussed the call and apply methods, you may have realized that this is more fluid in JavaScript than in other languages. While a function that is called normally will preserve the this method automatically, when a function is called in an unusual way—such as through window.setTimeout or as a callback to a jQuery event handler or AJAX call—that won't be the case. The window.setTimeout will change this to the global window object, while jQuery event callbacks will change this to the element that triggered the event...