ActionScript

JavaScript + Closure annotation

Notes

...rest

...rest

/**
 * @param\{...myType\}
 */
restVarName = Array.prototype.slice.call(arguments, numberOfOtherArguments);

Add a line 'resolving' the 'rest' in the function block

const

const

/**
 * @const
 */

 

extends

extends

/**
 * @extends {MyBaseClass}
 */

 

get/set

get/set


/**
 * @type {string}
 */
MyClass.prototype.test;

Object.defineProperty(MyClass.prototype, 'test', {get: function() {return "GOTTEN";}, configurable: true});
Object.defineProperty(MyClass.prototype, 'test', {set: function(value) {alert(value);}, configurable: true});

if (Object.prototype.__defineGetter__&&!Object.defineProperty) {
    Object.defineProperty=function(obj,prop,desc) {
        if ("get" in desc) obj.__defineGetter__(prop,desc.get);
        if ("set" in desc) obj.__defineSetter__(prop,desc.set);
    }
}

or maybe, if we want to push IE < 9 support, something like:
http://johndyer.name/native-browser-get-set-properties-in-javascript/

implements

implements


/**
 * @extends \{MyInterface\}
 */

 

interface

interface


/**
 * @interface
 */

 

namespace

namespace

?

It seems that if namespaces are allowed they would be some special kind of additional naming convention added to a field or method name.
Namespaces are going to need to be talked about.

package

package


goog.provides("my.package.MyClass")

 

  • No labels