Skip to content
qtoden edited this page Sep 12, 2012 · 2 revisions

This project uses John Resig's Simple JavaScript Inheritance to simulate classical object oriented inheritance. However, to make the code compile in Google Closure's advanced mode, some annotations has to be made added.

Resig's original API works like this:

SubClass = SuperClass.extend({
    init: function () {
        // ...
    },
    // ...
}

That approach still works, but if you want the project to compile with Closure, the following annotations must be added:

/**
 * @constructor
 * @extends SuperClass
 */
SubClass = SuperClass.extend(
/** @lends {SubClass.prototype} */
{
    /** @constructs */
    init: function () {
        // ...
    },
    // ...
}

Clone this wiki locally