售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Mastering Backbone.js
Table of Contents
Mastering Backbone.js
Credits
About the Author
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. Architecture of a Backbone application
Subapplications based architecture
Subapplication anatomy
Responsibilities of Backbone objects
Views
Models
Collections
Routers
Objects not provided by Backbone
Subapplication façade
Subapplication controller
Contacts application
File organization
Summary
2. Managing Views
Identifying view types
ModelView
CollectionView
Adding new models
Deleting models
Destroying views
Resetting the collection
Region
Layout
Putting it all together
Showing a list
Showing the details
Editing information
Rendering third-party plugins
Conclusions
3. Model Bindings
Manual binding
Two-way binding
References
Data binding with plugins
Binding embedded data
Binding an embedded list
Validating model data
Manual validation
Validating with the Backbone.Validation plugin
Summary
4. Modular Code
CommonJS modules
NPM and package.json
Browserify
Application dependency
Using Browserify in the app
Solving cyclic dependency
Modularizing templates
Summary
5. Dealing with Files
Express server
Attaching a file into a resource
Uploading the avatar photo to contacts
Showing the avatar
Uploading images from Backbone
Uploading a file with AJAX
Uploading the avatar image at creation time
Encoding the upload file
Summary
6. Store data in the Browser
The localStorage
Starting with localStorage
Backbone and localStorage
Store models in localStorage
Store Backbone models in localStorage
Backbone.sync
Using localStorage as cache
IndexedDB
Getting started with IndexedDB
Database versions
Creating stores
Delete a database
Add elements to an object store
Performing queries
Delete objects in the store
IndexedDB in Backbone
Summary
7. Build Like a Pro
Development workflow
What's a task runner?
How Gulp works
Getting started with Gulp
Creating a development workflow
Bundling the JavaScript files with Browserify
Sourcemaps
Re-bundle automatically
BrowserSync
Run server with Express
Creating a production workflow
Gulp useref
Image Optimization
Fonts
Bundle JavaScript files for production
Putting it all together
Summary
8. Testing Backbone Applications
Testing tools
Getting started with Jasmine
Expectations
Testing asynchronous code
Karma test runner
What and how to test Backbone applications
Testing models and collections
Testing views
Testing controllers
Mocking dependencies
Fake objects
Testing ContactEditor
Testing the subapplication Façade
Summary
9. Deploying to Production
Heroku
Dynos
Getting started with Heroku
Production environment
The HTTP Server
Do not run as root
Process Management
Summary
10. Authentication
Stateless API authentication
HTTP Basic authentication
The OAuth2 authentication
Service applications
OAuth2 grant types
Authorization code grant
Implicit Grant
Resource Owner Password Credentials Grant
Client credentials grant
Resume
Implementing HTTP Basic Authentication
Implementing OAuth authentication
Summary
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜