From 12d94e1405f520598133eb8d45d46bdb8a4610d8 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Wed, 16 Jul 2014 23:16:30 -0600 Subject: [PATCH 1/2] Document ol.inherits and annotate as a function --- src/ol/ol.js | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/ol/ol.js b/src/ol/ol.js index c0fb425dd8..465d2c3687 100644 --- a/src/ol/ol.js +++ b/src/ol/ol.js @@ -208,14 +208,34 @@ ol.ZOOMSLIDER_ANIMATION_DURATION = 200; /** - * ol.inherits is an alias to the goog.inherits function. It is exported - * for use in non-compiled application code. + * Inherit the prototype methods from one constructor into another. * - * FIXME: We use a new line to fake the linter. Without the new line the - * linter complains with: + * Usage: * - * "Missing newline between constructor and goog.inherits" + * function ParentClass(a, b) { } + * ParentClass.prototype.foo = function(a) { } + * + * function ChildClass(a, b, c) { + * goog.base(this, a, b); + * } + * ol.inherits(ChildClass, ParentClass); + * + * var child = new ChildClass('a', 'b', 'see'); + * child.foo(); // This works. + * + * In addition, a superclass' implementation of a method can be invoked as + * follows: + * + * ChildClass.prototype.foo = function(a) { + * ChildClass.superClass_.foo.call(this, a); + * // Other code here. + * }; + * + * @param {Function} childCtor Child constructor. + * @param {Function} parentCtor Parent constructor. + * @function * @api */ ol.inherits = goog.inherits; +// note that the newline above is necessary to satisfy the linter From b0c0d077c98f3d5a7cc8ec01d2750cfd38cdef81 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Wed, 16 Jul 2014 23:16:51 -0600 Subject: [PATCH 2/2] Annotate always and never conditions as functions --- src/ol/events/condition.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ol/events/condition.js b/src/ol/events/condition.js index 8f17ceb261..ddc5c54b37 100644 --- a/src/ol/events/condition.js +++ b/src/ol/events/condition.js @@ -50,6 +50,7 @@ ol.events.condition.altShiftKeysOnly = function(mapBrowserEvent) { * Always true. * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. * @return {boolean} True. + * @function * @api */ ol.events.condition.always = goog.functions.TRUE; @@ -79,6 +80,7 @@ ol.events.condition.mouseMove = function(mapBrowserEvent) { * Always false. * @param {ol.MapBrowserEvent} mapBrowserEvent Map browser event. * @return {boolean} False. + * @function * @api */ ol.events.condition.never = goog.functions.FALSE;