PacktLib: Backbone.js Patterns and Best Practices

Backbone.js Patterns and Best Practices

Credits

About the Author

Acknowledgments

About the Reviewers

www.PacktPub.com

Preface

Reducing Boilerplate with Plugin Development

Basic components of Backbone.js

Using Underscore.js

Re-using code with extensions

Understanding JavaScript mixins

Summary

Working with Views

Basic usage of views

Partially updating a view

Understanding nested views

Working with templates

Understanding automatic model-view data binding

Using Marionette's ItemView, CollectionView, and CompositeView

Using Layout Manager

Summary

Working with Models

Basic usage of models

Validating the data

Serializing models

Understanding the relational data model

Summary

Working with Collections

Basic usage of collections

Sorting a collection

Filtering a collection

Understanding the collection of multiple model types

Summary

Routing Best Practices and Subrouting

Working with routers

Best practices for working with routers

Subrouting – a key to organizing complex apps

Summary

Working with Events, Sync, and Storage

Understanding custom events

Using an event dispatcher

Avoiding memory leaks with the listenTo() method

Overriding the Backbone.sync() method

Offline storage using the Backbone.LocalStorage adapter

Summary

Organizing Backbone Applications – Structure, Optimize, and Deploy

Understanding the application directory structure

Working with Asynchronous Module Definition

Creating application architecture

Summary

Unit Test, Stub, Spy, and Mock Your App

Understanding why unit testing is important

Testing with QUnit

Using test spies, stubs, and mocks with SinonJS

Summary

Books, Tutorials, and References

Books, Tutorials, and References

Books, Tutorials, and References

Precompiling Templates on the Server Side

Organizing Templates with AMD and Require.js

Organizing Templates with AMD and Require.js

Index