kuzmisin/closurecheatsheet — pull request #8 by jart (2014-07-21 16:34:01+00:00)
Title: Prefer Class.base() over goog.base()

`goog.base` is not compatible in es5 strict mode. A replacement is available in the form of a base method added to constructors by `goog.inherit`.

The syntax is slightly different when calling from a constructor, so it is best to give an example:

Example before:

/** @constructor @extends {B} */
function C() {
goog.base(this);
}
goog.inherit(C, B);

C.prototype.method = function() {
goog.base(this, 'method');
}

Example after:

/** @constructor @extends {B} */
function C() {
C.base(this, 'constructor');
}
goog.inherit(C, B);

C.prototype.method = function() {
C.base(this, 'method');
}

Both `goog.base` and `C.base` are rewritten by the compiler when optimizations are enabled, so there are no differences in the resulting output. Please note however that `goog.base(this, 'constructor')` is **not** valid.