Home Page Icon
Home Page
Table of Contents for
Table of Contents
Close
Table of Contents
by Jeremy Walker
Backbone.js Essentials
Backbone.js Essentials
Table of Contents
Backbone.js Essentials
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. Building a Single-Page Site Using Backbone
What is Backbone?
Why choose Backbone?
A Brief History of Web Development
Benefits of Backbone and single-page applications
Full User Interface Asset Control
Simpler Data Management and Event Triggers
Enhanced performance
Backbone and Its Competitors
Summary
2. Object-Oriented JavaScript with Backbone Classes
JavaScript's class system
The new keyword
Prototypal inheritance
Extending Backbone classes
Introducing Underscore
More Underscore
Each, Map, and Reduce
Extend and defaults
Pluck and invoke
Further reading
Summary
3. Accessing Server Data with Models
The purpose of Models
Attributes, options, and properties
Getters and setters
Listening for events
Available events
Custom events
Server-side actions
Storing URLs on the client
Identification
Fetching data from the server
Saving data to the server
Validation
Return of Underscore
Summary
4. Organizing Models with Collections
Working with Collections
Collections and Models
Adding to and resetting Collections
Indexing
Sorting
Events
Server-side actions
Underscore methods
Previously mentioned methods
Testing methods
Extraction methods
Ordering methods
Summary
5. Adding and Modifying Elements with Views
Views are the core of Backbone-powered sites
Instantiating Views
Rendering view content
Connecting Views to Models and Collections
Accessing a View's el element
A brief aside on $Variable names
Handling events
Rendering strategies
Simple templating
Advanced templating
Logic-based
The combined approach
Other render considerations
Child views
Repeatable versus one-time renders
Return value – this or this.$el
Summary
6. Creating Client-side Pages with Routers
Backbone routers enable single-page applications
How Routers work
Backbone.history
Differences between routes and pages
Creating a new Router
Creating routes
Route styles
A note about routing conflicts
Trailing slashes
Redirects
404s and other errors
Routing events
Multiple routers
Page views
Summary
7. Fitting Square Pegs in Round Holes – Advanced Backbone Techniques
Taking it up a notch
Methods in place of properties
Collection.model as a factory method
Overriding a class constructor
Class mixins
Publish/subscribe
Wrapping widgets of other libraries
Summary
8. Scaling Up – Ensuring Performance in Complex Applications
Backbone and performance
Causes of performance issues
CPU-related performance issues
Event delegation
Bandwidth-related performance issues
Downloading excessively large files
Downloading excessive number of files
Memory-related performance issues
Summary
9. What Was I Thinking? Documenting Backbone Code
Backbone and documentation
Documentation approaches
The non-documentation approach
Benefits of non-documentation for other approaches
The simple documentation approach
The robust documentation approach
JSDoc
Docco
Summary
10. Keeping the Bugs Out – How to Test a Backbone Application
Testing in JavaScript?
Which library to use
Getting started with Mocha
TDD versus BDD: What's the difference?
Describe, beforeEach, and it
Running our test
Introducing mocks
Selenium
Summary
11. (Not) Re-Inventing the Wheel – Utilizing Third-Party Libraries
The Backbone ecosystem
Dependency management with RequireJS
External dependency management with Bower
Paginating with Backbone Paginator
Rendering tables with Backgrid.js
Templating with Handlebars
Automating tasks with Grunt
New syntax with CoffeeScript
Making life easier with BackSupport
Summary
12. Summary and Further Reading
Putting it all together
What's Syapse?
The 10,000-foot view
The View layer
The Data layer
The Support layer
Building your own Syapse
Further reading
Summary
Index
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Cover
Next
Next Chapter
Backbone.js Essentials
Table of Contents
Backbone.js Essentials
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. Building a Single-Page Site Using Backbone
What is Backbone?
Why choose Backbone?
A Brief History of Web Development
Benefits of Backbone and single-page applications
Full User Interface Asset Control
Simpler Data Management and Event Triggers
Enhanced performance
Backbone and Its Competitors
Summary
2. Object-Oriented JavaScript with Backbone Classes
JavaScript's class system
The new keyword
Prototypal inheritance
Extending Backbone classes
Applying parent methods
Introducing Underscore
More Underscore
Each, Map, and Reduce
Extend and defaults
Pluck and invoke
Further reading
Summary
3. Accessing Server Data with Models
The purpose of Models
Attributes, options, and properties
Getters and setters
Listening for events
Available events
Custom events
Server-side actions
Storing URLs on the client
Identification
Fetching data from the server
Saving data to the server
Validation
Return of Underscore
Summary
4. Organizing Models with Collections
Working with Collections
Collections and Models
Adding to and resetting Collections
Indexing
Sorting
Events
Server-side actions
Underscore methods
Previously mentioned methods
Testing methods
Extraction methods
Ordering methods
Summary
5. Adding and Modifying Elements with Views
Views are the core of Backbone-powered sites
Instantiating Views
Rendering view content
Connecting Views to Models and Collections
Accessing a View's el element
A brief aside on $Variable names
Handling events
Rendering strategies
Simple templating
Advanced templating
Logic-based
The combined approach
Other render considerations
Child views
Repeatable versus one-time renders
Return value – this or this.$el
Summary
6. Creating Client-side Pages with Routers
Backbone routers enable single-page applications
How Routers work
Backbone.history
Differences between routes and pages
Creating a new Router
Creating routes
Route styles
A note about routing conflicts
Trailing slashes
Redirects
404s and other errors
Routing events
Multiple routers
Page views
Summary
7. Fitting Square Pegs in Round Holes – Advanced Backbone Techniques
Taking it up a notch
Methods in place of properties
Collection.model as a factory method
Overriding a class constructor
Class mixins
Publish/subscribe
Wrapping widgets of other libraries
Summary
8. Scaling Up – Ensuring Performance in Complex Applications
Backbone and performance
Causes of performance issues
CPU-related performance issues
Event delegation
Bandwidth-related performance issues
Downloading excessively large files
Downloading excessive number of files
Memory-related performance issues
Summary
9. What Was I Thinking? Documenting Backbone Code
Backbone and documentation
Documentation approaches
The non-documentation approach
Benefits of non-documentation for other approaches
The simple documentation approach
The robust documentation approach
JSDoc
Docco
Summary
10. Keeping the Bugs Out – How to Test a Backbone Application
Testing in JavaScript?
Which library to use
Getting started with Mocha
TDD versus BDD: What's the difference?
Describe, beforeEach, and it
Running our test
Introducing mocks
Selenium
Summary
11. (Not) Re-Inventing the Wheel – Utilizing Third-Party Libraries
The Backbone ecosystem
Dependency management with RequireJS
External dependency management with Bower
Paginating with Backbone Paginator
Rendering tables with Backgrid.js
Templating with Handlebars
Automating tasks with Grunt
New syntax with CoffeeScript
Making life easier with BackSupport
Summary
12. Summary and Further Reading
Putting it all together
What's Syapse?
The 10,000-foot view
The View layer
The Data layer
The Support layer
Building your own Syapse
Further reading
Summary
Index
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset