Well, the power comes from Closure a library and set of tools that the great JS hackers built over time as they created the applications at scale.
As soon as I joined Google I wanted to check out this code, and talked to a bunch of folks who were interested in open sourcing it. Well, these things take time, but now we are fortunate enough to have everything out there (interestingly, a lot of the code was open due to it being used in Google Doc).
What are the pieces?
compact, high-performance code. The compiler removes dead code and
rewrites and minimizes what’s left so that it downloads and runs
quickly. It also also checks syntax, variable references, and
optimizations help you write apps that are less buggy and easier to
maintain. You can use the compiler with Closure Inspector, a Firebug
extension that makes debugging the obfuscated code almost as easy as
debugging the human-readable source.
The Closure Library is a broad,
can pull just what you need from a large set of reusable UI
widgets and controls, and from lower-level utilities for
DOM manipulation, server communication, animation, data structures, unit
testing, rich-text editing, and more.
The Closure Library is server-agnostic, and is intended for use
with the Closure Compiler.
Closure Templates simplify the task of
dynamically generating HTML. They have a simple syntax that is
natural for programmers. In contrast to traditional templating
systems, in which you use one big template per page, you can
think of Closure Templates as small components that you compose to
form your user interface.
that you can use the same templates on both the server and client
side. For the client side, Closure Templates are precompiled into
Check it out. It is a little like an inside out Dojo in some ways. There are years of lessons hidden in this code too (especially around good practices for scalable code, cross browser issues, and perf).
Congrats to the people that made this happen. What do you think of Closure?
Erik has posted on the history of Closure and also talks about the future a bit:
I hope we can see more code being shared among the different open source JS libraries out there. We would love to be able to goog.require some Dojo code (especially their data model code) and I’m sure they would love to be able to dojo.require our data structures and i18n code.
Posted by Dion Almaer at 3:08 pm