Closure: The Definitive Guide


If you're ready to use Closure to build rich web applications with JavaScript, this hands-on guide has precisely what you need to learn this suite of tools in depth. Closure makes it easy for experienced JavaScript developers to write and maintain large and complex codebases—as Google has demonstrated by using Closure with Gmail, Google Docs, and Google Maps.

Author and Closure contributor Michael Bolin has included numerous code examples and best practices, as well as valuable ...

See more details below
Other sellers (Paperback)
  • All (14) from $1.99   
  • New (9) from $27.73   
  • Used (5) from $1.99   
Closure: The Definitive Guide

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$17.99 price
(Save 43%)$31.99 List Price


If you're ready to use Closure to build rich web applications with JavaScript, this hands-on guide has precisely what you need to learn this suite of tools in depth. Closure makes it easy for experienced JavaScript developers to write and maintain large and complex codebases—as Google has demonstrated by using Closure with Gmail, Google Docs, and Google Maps.

Author and Closure contributor Michael Bolin has included numerous code examples and best practices, as well as valuable information not available publicly until now. You'll learn all about Closure's Library, Compiler, Templates, testing framework, and Inspector—including how to minify JavaScript code with the Compiler, and why the combination of the Compiler and the Library is what sets Closure apart from other JavaScript toolkits.

  • Learn how the Compiler significantly reduces the amount of JavaScript users have to download when visiting your site
  • Discover several ways to use the Compiler as part of your build process
  • Learn about type expressions, primitives, and common utilities
  • Understand how Closure emulates classes and class-based inheritance
  • Use Closure Templates on the server and the client from either JavaScript or Java
  • Test and debug your JavaScript code, even when it's compiled
Read More Show Less

Product Details

  • ISBN-13: 9781449381875
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 9/27/2010
  • Edition number: 1
  • Pages: 592
  • Product dimensions: 7.00 (w) x 9.10 (h) x 1.20 (d)

Meet the Author

Michael Bolin is a former Google engineer who spent his four years there working on Google Calendar, Google Tasks, and the Closure Compiler. As a frontend developer, he used the Closure Tools suite on a daily basis and made a number of contributions to it. His last project at Google was to open-source the Closure Compiler. He is a blogger, often writing about web development, and graduated with both Computer Science and Mathematics degrees from MIT.

Read More Show Less

Table of Contents

My Experiences with Closure;
ECMAScript Versus JavaScript;
Using This Book;
Conventions Used in This Book;
Using Code Examples;
Safari® Books Online;
How to Contact Us;
Chapter 1: Introduction to Closure;
1.1 Tools Overview;
1.2 Closure Design Goals and Principles;
1.3 Downloading and Installing the Tools;
1.4 Example: Hello World;
Chapter 2: Annotations for Closure JavaScript;
2.1 JSDoc Tags;
2.2 Type Expressions;
2.3 JSDoc Tags That Do Not Deal with Types;
2.4 Is All of This Really Necessary?;
Chapter 3: Closure Library Primitives;
3.1 Dependency Management;
3.2 Function Currying;
3.3 Exports;
3.4 Type Assertions;
3.5 Unique Identifiers;
3.6 Internationalization (i18n);
3.7 Object Orientation;
3.8 Additional Utilities;
Chapter 4: Common Utilities;
4.1 goog.string;
4.2 goog.array;
4.3 goog.object;
4.4 goog.json;
4.5 goog.dom;
4.6 goog.dom.classes;
4.7 goog.userAgent;
4.8 goog.userAgent.product;
4.11 goog.functions;
Chapter 5: Classes and Inheritance;
5.1 Example of a Class in Closure;
5.2 Example of a Subclass in Closure;
5.3 Example of an Interface in Closure;
5.4 Multiple Inheritance;
5.5 Enums;
5.6 goog.Disposable;
Chapter 6: Event Management;
6.1 A Brief History of Browser Event Models;
6.2 Closure Provides a Consistent DOM Level 2 Events API Across Browsers;
6.3 Handling Keyboard Events;
Chapter 7: Client-Server Communication;
7.1 Server Requests;
7.2 Resource Loading and Monitoring;
7.3 Cross-Domain Communication;
7.4 Uploading Files;
7.5 Comet;
Chapter 8: User Interface Components;
8.1 Design Behind the goog.ui Package;
8.2 goog.ui.Component;
8.3 goog.ui.Control;
8.4 goog.ui.Container;
8.5 Using Common Components;
8.6 Creating Custom Components;
Chapter 9: Rich Text Editor;
9.1 Design Behind the goog.editor Package;
9.2 Creating an Editable Region;
9.3 Extending the Editor: The Plugin System;
9.4 UI Components;
9.5 Selections;
Chapter 10: Debugging and Logging;
10.1 Creating Logging Information;
10.2 Displaying Logging Information;
10.3 Profiling JavaScript Code;
10.4 Reporting JavaScript Errors;
Chapter 11: Closure Templates;
11.1 Limitations of Existing Template Systems;
11.2 Introducing Closure Templates;
11.3 Creating a Template;
11.4 Internationalization (i18n);
11.5 Compiling Templates;
11.6 Defining a Custom Function;
Chapter 12: Using the Compiler;
12.1 Benefits of Using the Compiler;
12.2 How the Compiler Works;
12.3 Compiler Options;
12.4 Running the Compiler;
12.5 Integrating the Compiler into a Build Process;
12.6 Partitioning Compiled Code into Modules;
Chapter 13: Advanced Compilation;
13.1 What Happens During Compilation;
13.2 Preparing Code for the Compiler;
13.3 Checks Provided by the Compiler;
13.4 Optimizations Performed by the Compiler;
Chapter 14: Inside the Compiler;
14.1 Tour of the Codebase;
14.2 Hidden Options;
14.3 Example: Extending CommandLineRunner;
14.4 Example: Visualizing the AST Using DOT;
14.5 Example: Creating a Compiler Check;
14.6 Example: Creating a Compiler Optimization;
Chapter 15: Testing Framework;
15.1 Creating Your First Test;
15.2 Mock Objects;
15.3 Testing to Ensure That an Error Is Thrown;
15.4 Testing Input Events;
15.5 Testing Asynchronous Behavior;
15.6 Running a Single Test;
15.7 Running Multiple Tests;
15.8 Automating Tests;
15.9 System Testing;
Chapter 16: Debugging Compiled JavaScript;
16.1 Verify That the Error Occurs in Uncompiled Mode;
16.2 Format Compiled Code for Debugging;
16.3 Compile with —debug=true;
16.4 Use the Closure Inspector;
Inheritance Patterns in JavaScript;
Example of the Functional Pattern;
Example of the Pseudoclassical Pattern;
Drawbacks to the Functional Pattern;
Potential Objections to the Pseudoclassical Pattern;
Frequently Misunderstood JavaScript Concepts;
JavaScript Objects Are Associative Arrays Whose Keys Are Always Strings;
There Are Several Ways to Look Up a Value in an Object;
Single-Quoted Strings and Double-Quoted Strings Are Equivalent;
There Are Several Ways to Define an Object Literal;
The prototype Property Is Not the Prototype You Are Looking For;
The Syntax for Defining a Function Is Significant;
What this Refers to When a Function Is Called;
The var Keyword Is Significant;
Block Scope Is Meaningless;
Getting Started with plovr;
Config Files;
Build Command;
Serve Command;
Generating Externs from Exports;
Generating a Source Map;

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 2 Customer Reviews
  • Anonymous

    Posted December 15, 2010

    No text was provided for this review.

  • Anonymous

    Posted August 16, 2011

    No text was provided for this review.

Sort by: Showing all of 2 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)