E-book details

Backbone.js Patterns and Best Practices. Improve your Backbone.js skills with this step-by-step guide to patterns and best practice. It will help you reduce boilerplate in your code and provide plenty of open source plugin solutions to common problems along the way

Backbone.js Patterns and Best Practices. Improve your Backbone.js skills with this step-by-step guide to patterns and best practice. It will help you reduce boilerplate in your code and provide plenty of open source plugin solutions to common problems along the way

Swarnendu De

Ebook
  • Backbone.js Patterns and Best Practices
    • Table of Contents
    • Backbone.js Patterns and Best Practices
    • Credits
    • About the Author
    • Acknowledgments
    • About the Reviewers
    • www.PacktPub.com
      • Support files, eBooks, discount offers and more
        • Why Subscribe?
        • Free Access for Packt account holders
    • Preface
      • What this book covers
      • What you need for this book
      • Who this book is for
      • Conventions
      • Reader feedback
      • Customer support
        • Downloading the example code
        • Errata
        • Piracy
        • Questions
    • 1. Reducing Boilerplate with Plugin Development
      • Basic components of Backbone.js
      • Using Underscore.js
      • Re-using code with extensions
        • Creating a base class
        • Developing plugins without extending base classes
      • Understanding JavaScript mixins
        • What is a mixin?
        • Creating classic mixins
        • Creating functional mixins
          • Caching mixin functions
          • Using curry to combine a function and arguments
      • Summary
    • 2. Working with Views
      • Basic usage of views
        • Understanding the el property
        • Listening to view events
        • Displaying model data with templates
      • Partially updating a view
      • Understanding nested views
        • Knowing when to use subviews
        • Avoiding multiple DOM reflow
        • Re-rendering parent views
        • Removing parent views
      • Working with templates
        • Storing templates in an HTML file
        • Storing templates in a JavaScript file
        • Precompiling templates
        • Avoiding evaluation in templates
        • Using template helper functions
      • Understanding automatic model-view data binding
      • Using Marionettes ItemView, CollectionView, and CompositeView
        • ItemView
        • CollectionView
        • Working with CompositeView
      • Using Layout Manager
      • Summary
    • 3. Working with Models
      • Basic usage of models
        • Using the defaults property
          • Avoiding object references in the defaults property
        • Data interaction with the server
          • Creating a model
          • Updating a model
          • Fetching a model
          • Deleting a model
      • Validating the data
        • Using the Backbone.Validation plugin
          • Configuring validation rules
          • Prevalidating a model with the preValidate() method
      • Serializing models
      • Understanding the relational data model
      • Summary
    • 4. Working with Collections
      • Basic usage of collections
        • Performing data operations with collections
          • Fetching data from the server
          • Saving data to the server
      • Sorting a collection
        • Sorting a collection with multiple attributes
      • Filtering a collection
        • Performing basic filtering
        • Filtering a collection with a duplicate collection
        • Self-filtering with full data pointers
      • Understanding the collection of multiple model types
      • Summary
    • 5. Routing Best Practices and Subrouting
      • Working with routers
      • Best practices for working with routers
        • Avoiding large functional code in route methods
        • Instantiating views in router methods
        • Using regular expressions for selective routing
      • Subrouting a key to organizing complex apps
        • The all-in-one router
        • The base router
        • The Users module router
      • Summary
    • 6. Working with Events, Sync, and Storage
      • Understanding custom events
        • A simple case study on custom events
      • Using an event dispatcher
        • Creating multiple event dispatchers
        • Using different event namespaces
      • Avoiding memory leaks with the listenTo() method
      • Overriding the Backbone.sync() method
      • Offline storage using the Backbone.LocalStorage adapter
      • Summary
    • 7. Organizing Backbone Applications Structure, Optimize, and Deploy
      • Understanding the application directory structure
      • Working with Asynchronous Module Definition
        • Adding Require.js to your project
        • Configuring dependencies
        • Defining a module
      • Creating application architecture
        • Managing a project directory
        • Organizing code with AMD
        • Setting up an application
          • Using the module pattern
          • Managing objects and module communication
            • Using the observer/PubSub pattern
            • Using the mediator pattern
        • Understanding view management
        • Understanding other important features
      • Summary
    • 8. Unit Test, Stub, Spy, and Mock Your App
      • Understanding why unit testing is important
      • Testing with QUnit
        • Performing a basic test case
        • Understanding the QUnit module (), setup (), and teardown () methods
        • Testing Backbone.js components with QUnit
      • Using test spies, stubs, and mocks with SinonJS
        • Testing with spies
        • Testing with stubs
        • Testing with mocks
          • Difference between mocks and stubs
      • Summary
    • A. Books, Tutorials, and References
      • Books for reference
      • Tutorials
        • Unit testing
        • Other plugins and tutorials
    • B. Precompiling Templates on the Server Side
    • C. Organizing Templates with AMD and Require.js
      • Precompiling with the requirejs-tpl plugin
    • Index
  • Title: Backbone.js Patterns and Best Practices. Improve your Backbone.js skills with this step-by-step guide to patterns and best practice. It will help you reduce boilerplate in your code and provide plenty of open source plugin solutions to common problems along the way
  • Author: Swarnendu De
  • Original title: Backbone.js Patterns and Best Practices. Improve your Backbone.js skills with this step-by-step guide to patterns and best practice. It will help you reduce boilerplate in your code and provide plenty of open source plugin solutions to common problems along the way.
  • ISBN: 9781783283583, 9781783283583
  • Date of issue: 2014-01-24
  • Format: Ebook
  • Item ID: e_3co5
  • Publisher: Packt Publishing