The Closure Compiler is a tool for making JavaScript download and run faster. It is a true compiler for JavaScript. Instead of compiling from a source language to machine code, it compiles from JavaScript to better JavaScript. It parses your JavaScript, analyzes it, removes dead code and rewrites and minimizes what's left. It also checks syntax, variable references, and types, and warns about common JavaScript pitfalls.
Closure Compiler is a JavaScript optimizer that compiles web apps down into compact, high-performance JavaScript code.
Closure Library is a broad, well-tested, modular, and cross-browser JavaScript library. Web developers can pull just what they need from a wide set of reusable UI widgets and controls, as well as lower-level utilities for the DOM, server communication, animation, data structures, unit testing, rich-text editing, and much, much more. (Seriously. Check the docs.)
Closure Templates grew out of a desire for web templates that are precompiled to efficient JavaScript. Closure Templates have a simple syntax that is natural for programmers.
freedom to use the
same JavaScript routines on both servers and clients. In addition, the
techniques presented throughout this series will allow you to maintain a
single code base for both Ajax and non-Ajax clients
This
double-coding issue can be avoided by using JavaScript combined with Java
code on the server side, getting full support of scripting languages through the javax.script API. In addition, the Java SE Development Kit
(JDK) 6 already includes Mozilla's Rhino
JavaScript engine, which means no setup is required.
the toSource() method, which all JavaScript objects
must have.
all data exchange between the Java code and
the executed script should be done through primitive variables, strings, and Java
objects (for example, beans) whose properties and methods can be accessed very easily in the
JavaScript code. Simply said, don't try to access native JavaScript objects in your
Java code. Use Java objects in the JavaScript code instead.
Note
that javax.script.Invocable is an optional interface,
which some script engines may not implement. The JavaScript engine that comes with
JDK 6 does support this interface.
you
can significantly reduce the execution time by compiling the scripts, using the
methods provided by another optional interface named javax.script.Compilable, which is supported by the JavaScript engine of
JDK 6.
This article discusses the advantages of the pseudoclassical pattern over the functional pattern. I argue that the pattern used by the Closure Library paired with the Closure Compiler removes existing hazards while I also examine the hazards introduced by the functional pattern (as defined in The Good Parts). First let me demonstrate what I mean by the functional pattern.