which can be used when?
This is to some extent a matter of personal preference and coding style. The Closure Compiler is more inclined to the pseudo-classical inheritance pattern found in Java, with classes, interfaces, methods, etc., which are different from other approaches. See Inheritance Patterns in Michael Bolin JavaScript .
. JavaScript Closure, .
. 99% @constructor, new. @struct, . 80% , @implement a @interface, .
@typedef . , , .
:
Terminal.regexPair;
typedef :
this.regexs_ = [];
, - :
Terminal.prototype.addRegex = function(regex, replace) {
this.regexs_.push({regex:regex, replace:replace});
};
, {regex:regex, replace:replace} new. , () , Terminal.regexPair.
, JavaScript. , , typedef, .