万本电子书0元读

万本电子书0元读

顶部广告

Backbone.js Patterns and Best Practices电子书

售       价:¥

0人正在读 | 0人评论 9.8

作       者:Swarnendu De

出  版  社:Packt Publishing

出版时间:2014-01-24

字       数:75.4万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
This is a stepbystep guide to design patterns, best practices, and solutions to common problems for Backbone.jsbased application development. This book is for JavaScript developers who work with Backbone.js and want to learn the best design patterns to develop complex web applications. Basic knowledge of Backbone.js and JavaScript is essential.
目录展开

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 Marionette's 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

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部