Closure Lite

A single JavaScript file that contains the core of the Closure Library

If you are used to using a JavaScript library, such as jQuery, where all you need to do is link to one JavaScript file in your web page to get started, you may find the barrier to entry for the Closure Library a bit high. Although the instructions for getting started with the Closure Library are concise, they are not simple. The first step requires setting up a Subversion client, which is not so hard on Mac or Linux, but can be a bear on Windows.

Closure Lite aims to solve this problem by providing the core of the Closure Library in a single, minified JavaScript file that can be included in your own web page.

Usage

The Closure Lite library, closure-lite.js, can be included on any web page by adding the following snippet of HTML to the <head> element:

<script src="http://resources.programmingclosure.com/closure-lite.js"></script>

Closure Lite is approximately 33KB gzipped, which is slightly smaller than the minified version of Dojo 1.4.0 hosted on code.google.com, so the size of the download should not be a concern when considering using Closure Lite in development.

Note: Although Closure Lite can be used in production webapps, that is not the intention. Closure Lite is meant to lower the barrier to entry for Closure, but not to replace it. If you decide to adopt the Closure Library as your JavaScript library of choice, you should incorporate the entire Closure Tools suite into your build process to get the best performance out of your web application.

Closure Lite API

Closure Lite includes the following APIs from Closure:

How Closure Lite is Built

Closure Lite is built by using the Closure Compiler to compile the following JavaScript code. It uses a custom Compiler pass to generate calls to goog.exportSymbol() during compilation so that the public API of the included libraries is exposed in closure-lite.js.

The code used to build Closure Lite is available from http://code.google.com/p/closure-experiments. See the closure-lite target in build.xml for details.

goog.require('goog.array');
goog.require('goog.Disposable');
goog.require('goog.dispose');
goog.require('goog.dom');
goog.require('goog.dom.DomHelper');
goog.require('goog.dom.NodeType');
goog.require('goog.dom.TagName');
goog.require('goog.dom.classes');
goog.require('goog.dom.xml');
goog.require('goog.events');
goog.require('goog.events.BrowserEvent');
goog.require('goog.events.BrowserEvent.MouseButton');
goog.require('goog.events.Event');
goog.require('goog.events.EventHandler');
goog.require('goog.events.EventType');
goog.require('goog.events.EventTarget');
goog.require('goog.events.KeyEvent');
goog.require('goog.events.KeyCodes');
goog.require('goog.events.KeyHandler');
goog.require('goog.events.KeyHandler.EventType');
goog.require('goog.events.Listener');
goog.require('goog.functions');
goog.require('goog.json');
goog.require('goog.math.Box');
goog.require('goog.math.Coordinate');
goog.require('goog.math.Rect');
goog.require('goog.math.Size');
goog.require('goog.net.ErrorCode');
goog.require('goog.net.EventType');
goog.require('goog.net.XhrIo');
goog.require('goog.net.xhrMonitor');
goog.require('goog.net.XmlHttp');
goog.require('goog.object');
goog.require('goog.string');
goog.require('goog.structs');
goog.require('goog.structs.Map');
goog.require('goog.structs.Set');
goog.require('goog.style');
goog.require('goog.Timer');
goog.require('goog.userAgent');
goog.require('goog.userAgent.product');
goog.require('goog.window');