Backbone.js Cookbook


Backbone.js Cookbook
eBook: $26.99
Formats: PDF, PacktLib, ePub and Mobi formats
$22.94
save 15%!
Print + free eBook + free PacktLib access to the book: $71.98    Print cover: $44.99
$44.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • Easy-to-follow recipes to build dynamic web applications
  • Learn how to integrate with various frontend and mobile frameworks
  • Synchronize data with a RESTful backend and HTML5 local storage
  • Learn how to optimize and test Backbone applications

Book Details

Language : English
Paperback : 282 pages [ 235mm x 191mm ]
Release Date : August 2013
ISBN : 1782162720
ISBN 13 : 9781782162728
Author(s) : Vadim Mirgorod
Topics and Technologies : All Books, Web Development, Cookbooks, Open Source, Web Development

Table of Contents

Preface
Chapter 1: Understanding Backbone
Chapter 2: Models
Chapter 3: Collections
Chapter 4: Views
Chapter 5: Events and Bindings
Chapter 6: Templates and UX sugar
Chapter 7: REST and Storage
Chapter 8: Special Techniques
Index
  • Chapter 1: Understanding Backbone
    • Introduction
    • Designing an application with the MVC pattern
    • Defining business logic with models and collections
    • Modeling an application's behavior with views and a router
    • Creating an application structure from scratch
    • Writing your first Backbone application
    • Implementing URL routing in your application
    • Extending an application with plugins
    • Contributing to the Backbone project
    • Chapter 2: Models
      • Introduction
      • Creating a model
      • Operating with model attributes
      • Operating with the model identifier
      • Validating model attributes
      • Overriding getters and setters
      • Creating undo points to store/restore a model's state
      • Implementing workflow for a model
      • Using advanced validation in a model
      • Validating an HTML form
      • Working with nested attributes in a model
      • Implementing a one-to-one relationship
      • Chapter 3: Collections
        • Introduction
        • Creating a collection of models
        • Getting a model from a collection by its index
        • Getting a model from a collection by its ID
        • Adding a model to a collection
        • Removing a model from a collection
        • Working with a collection as a stack or as a queue
        • Sorting a collection
        • Filtering models in a collection
        • Iterating through a collection
        • Chaining a collection
        • Running No SQL queries on a collection
        • Storing models of various types in the same collection
        • Implementing a one-to-many relationship
        • Chapter 4: Views
          • Introduction
          • Rendering a view
          • Dealing with a view element using jQuery
          • Rendering a model in a view
          • Rendering a collection in a view
          • Splitting a view into subviews
          • Handling Document Object Model (DOM) events in a view
          • Switching views using Backbone.Router
          • Chapter 5: Events and Bindings
            • Introduction
            • Managing events in Backbone.js
            • Handling events of Backbone objects
            • Binding a model to a view
            • Binding a collection to a view
            • Bidirectional binding with Backbone.stickit
            • Binding a model and a collection to a select list
            • Handling keyboard shortcuts in a view
            • Handling router events
            • Chapter 6: Templates and UX sugar
              • Introduction
              • Using templates in a view
              • Implementing a template loader
              • Using Mustache templates
              • Defining a form
              • Adding validation to a form
              • Handling form events
              • Customizing a form with the Bootstrap framework
              • Assembling layouts with LayoutManager
              • Building a semantic and an easily styleable data grid
              • How it works...
              • Drawing on the HTML5 canvas
              • Chapter 7: REST and Storage
                • Introduction
                • Architecting the REST API for the backend
                • Prototyping a RESTful backend with MongoLab
                • Synchronizing models and collections with a RESTful service
                • Building a RESTful frontend with Backbone
                • Using the polling technique to fetch data
                • Working with local storage
                • Chapter 8: Special Techniques
                  • Introduction
                  • Using mixins with Backbone objects
                  • Creating a Backbone.js extension with Grunt
                  • Writing tests for a Backbone extension with QUnit
                  • Mocking up a RESTful service with jQuery Mockjax in asynchronous tests
                  • Developing a mobile application with jQuery Mobile
                  • Building an iOS/Android app with PhoneGap
                  • Organizing a project structure with Require.js
                  • Ensuring compatibility with search engines
                  • Avoiding memory leaks in a Backbone application

                  Vadim Mirgorod

                  Vadim Mirgorod is a professional web developer and an open source expert, who is passionate about technologies and innovations. He provides the code for the content management system Drupal and maintains several Backbone.js plugins. He is an active community member, who organized IT events in his city and spoke at the international conferences in Chicago, Munich, and Portland. His recent session at DrupalCon Portland was about Backbone.js.

                  The following are some of the highlights of his career:

                  • Presently he is running a company known as CoderBlvd (http://www.coderblvd.com), which is based in Ukraine. CoderBlvd provides IT outsourcing services for international businesses.
                  • (August 2010- August 2013)He worked in Trellon, LLC as a Lead Developer, creating CRM-based systems and web applications, using Drupal and PHP.
                  • (July 2009- August 2010)He used to give web development classes, when he was working in Donetsk National Technical University.


                  You can reach him through his website at http://www.vmirgorod.name or by connecting to his Twitter account @dealancer.

                  Sorry, we don't have any reviews for this title yet.

                  Code Downloads

                  Download the code and support files for this book.


                  Submit Errata

                  Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


                  Errata

                  - 1 submitted: last submission 14 Mar 2014

                  Errata Type: Technical | Page No: 12

                  The tables for "4. We define InvoiceItemModel properties." and "5. Next, we define InvoiceItemModel methods." should be interchanged.

                  Sample chapters

                  You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                  Frequently bought together

                  Backbone.js Cookbook +    Object-Oriented JavaScript - Second Edition =
                  50% Off
                  the second eBook
                  Price for both: ₨351.00

                  Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                  What you will learn from this book

                  • Architecting and building dynamic web applications in an MVC style
                  • Modeling business logic with Backbone models and collections
                  • Rendering data with Backbone views
                  • Routing URLs within your application
                  • Communicating with a RESTful service
                  • Using HTML5 local storage to store models and collections
                  • Optimizing and testing Backbone applications
                  • Writing your own Backbone extensions
                  • Ensuring compatibility with search engines
                  • Creating mobile apps with jQueryMobile and PhoneGap

                  In Detail

                  There is no doubt that the superior rendering power of HTML5, thin-to-thick client transition and REST style communication created a new era in web development, replacing the outdated approach based on browser plugin technologies. Backbone.js allows developers to write lightweight, modular, and scalable JavaScript applications.

                  Backbone.js Cookbook contains a series of recipes that provide practical, step-by-step solutions to the problems that may occur during frontend application development using an MVC pattern. You will learn how to build Backbone applications utilizing the power of popular Backbone extensions and integrating your app with different third party libraries. You will also learn how to fulfill the requirements of the most challenging tasks.

                  The first chapter of the book introduces you to the MVC paradigm and teaches you how to architect rich Internet applications operating with basic concepts of Backbone.js. During the reading of this book you will learn how to solve challenging problems leveraging Backbone objects such as models, collections, views, routers, and so on.

                  You learn how to use forms, layouts, templating engines, and other Backbone extensions, which will help you to complete specific features of your application. You will understand how to bind a model to a DOM element. You will see how perfectly Backbone.js integrates with third party libraries and frameworks such as jQuery, Zepto, Underscore.js, Require.js, Mustache.js, Twitter Bootstrap, jQueryMobile, PhoneGap and many others. This book will guide you in how to optimize and test your applications, create your own Backbone extensions, and share them with the open source community.

                  With the help of Backbone.js Cookbook, you will learn everything you need to know to create outstanding rich Internet applications using the JavaScript programming language.

                  Approach

                  This is a Cookbook with easy-to-follow recipes, containing practical and detailed examples which are all fully backed up with code, illustrations, and tips to dig deep into Backbone.js.

                  Who this book is for

                  This book is great for JavaScript developers who want to learn how to build advanced frontend applications with the Backbone.js framework. This book can be used in educational institutions to teach students how to build frontend applications in an MVC manner.

                  It's assumed that you have some experience in jQuery, and are familiar with HTML.

                  Code Download and Errata
                  Packt Anytime, Anywhere
                  Register Books
                  Print Upgrades
                  eBook Downloads
                  Video Support
                  Contact Us
                  Awards Voting Nominations Previous Winners
                  Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                  Resources
                  Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software