Tuesday, February 11, 2014

Closure IDE Update 1.2.0.201402101718

Closure IDE

Closure IDE Update 1.2.0.201402101718

Support Closure-based stuff

Closure Library brings a list of special functions which help you to declare JavaScript objects.
The update introduces support for the goog.inherits, goog.abstractMethod, goog.addSingletonGetter

goog.inherits

The method brings inheritance mechanism to JavaScript code. The function enriches your JS object/type with constructor_ and superclass_ fields. The superclass_ field can be used to call the super implementation of a method.

goog.abstractMethod

goog.abstractMethod can be used as a default implementation for your abstract methods.

goog.addSingletonGetter

The function allows you to easily implement Singleton Pattern for JavaScript objects. As a result, your JS object will have getInstance method that always returns the same instance of the object.

Support @typedef

JSDoc tag @typedef allows you to declare an alias for a more complex type. For example:
/** @typedef {(string|number)} */
goog.NumberLike;
The IDE supports type definitions in the same way as common types. The type definitions are marked by icon.
Types declared by @typedef tag can be open using Open Type:
Or using Open Declaration:
And properly supported by the content assist:

Support inner this.* declarations

Now the IDE supports declarations of fields and methods inside the constructor of an object. So, both of the following declarations are supported:
goog.provide("my.project.JSApp");

/**
* @constructor
*/
my.project.JSApp = function(){
}

/**
* @type {string}
* @private
*/
my.project.JSApp.prototype.name = "";

/**
* @return {string}
*/
my.project.JSApp.prototype.getName = function(){
    return this.name;
}
goog.provide("my.project.JSApp");

/**
* @constructor
*/
my.project.JSApp = function(){
    /**
    * @type {string}
    * @private
    */
    this.name = "";

    /**
    * @return {string}
    */
    this.getName = function(){
        return this.name;
    }
}

Source Map Generation

Meet the power of JavaScript Source Maps in Closure IDE. Now you can generate a source map for your compiled code to debug it easily.

Moving to Closure Compiler v20140110

The update 1.2.0.x is bundled with the newest version of Closure Compiler - v20140110. For more information about the v20140110 update of the compiler, please read this post on Closure Compiler Discuss group.
The above features and other bugs are supported and fixed with special thanks to our user and tester Erik De Bruin.
Explore Update Notes for more details.
Post a Comment