Chromium Code Reviews| Index: ui/webui/resources/js/cr.js |
| diff --git a/ui/webui/resources/js/cr.js b/ui/webui/resources/js/cr.js |
| index a3d1263238642ed1d85e9709126cc0b50a1524fe..810c6bb5dee55bd2fa446f2187899019ffd6c981 100644 |
| --- a/ui/webui/resources/js/cr.js |
| +++ b/ui/webui/resources/js/cr.js |
| @@ -10,7 +10,7 @@ |
| var global = this; |
| /** Platform, package, object property, and Event support. **/ |
| -this.cr = (function() { |
| +var cr = global.cr = (function() { |
| 'use strict'; |
| /** |
| @@ -68,7 +68,7 @@ this.cr = (function() { |
| /** |
| * The kind of property to define in {@code defineProperty}. |
| - * @enum {number} |
| + * @enum {string} |
| * @const |
| */ |
| var PropertyKind = { |
| @@ -94,8 +94,8 @@ this.cr = (function() { |
| * Helper function for defineProperty that returns the getter to use for the |
| * property. |
| * @param {string} name The name of the property. |
| - * @param {cr.PropertyKind} kind The kind of the property. |
| - * @return {function():*} The getter for the property. |
| + * @param {PropertyKind} kind The kind of the property. |
| + * @return {Function|undefined} The getter for the property. |
|
arv (Not doing code reviews)
2014/07/16 18:33:02
This never returns undefined. Maybe add a `throw '
Dan Beam
2014/07/19 02:28:40
Done.
|
| */ |
| function getGetter(name, kind) { |
| switch (kind) { |
| @@ -122,11 +122,11 @@ this.cr = (function() { |
| * kind. |
| * @param {string} name The name of the property we are defining the setter |
| * for. |
| - * @param {cr.PropertyKind} kind The kind of property we are getting the |
| + * @param {PropertyKind} kind The kind of property we are getting the |
| * setter for. |
| - * @param {function(*):void} opt_setHook A function to run after the property |
| - * is set, but before the propertyChange event is fired. |
| - * @return {function(*):void} The function to use as a setter. |
| + * @param {Function=} opt_setHook A function to run after the property is set, |
| + * but before the propertyChange event is fired. |
| + * @return {Function|undefined} The function to use as a setter. |
|
arv (Not doing code reviews)
2014/07/16 18:33:02
same
Dan Beam
2014/07/19 02:28:40
Done.
|
| */ |
| function getSetter(name, kind, opt_setHook) { |
| switch (kind) { |
| @@ -179,15 +179,16 @@ this.cr = (function() { |
| * property change event with the type {@code name + 'Change'} is fired. |
| * @param {!Object} obj The object to define the property for. |
| * @param {string} name The name of the property. |
| - * @param {cr.PropertyKind=} opt_kind What kind of underlying storage to use. |
| - * @param {function(*):void} opt_setHook A function to run after the |
| + * @param {PropertyKind=} opt_kind What kind of underlying storage to use. |
| + * @param {function(*):void=} opt_setHook A function to run after the |
| * property is set, but before the propertyChange event is fired. |
| + * @suppress {checkTypes} |
| */ |
| function defineProperty(obj, name, opt_kind, opt_setHook) { |
| if (typeof obj == 'function') |
| obj = obj.prototype; |
| - var kind = opt_kind || PropertyKind.JS; |
| + var kind = /** @type {PropertyKind} */ (opt_kind || PropertyKind.JS); |
|
arv (Not doing code reviews)
2014/07/16 18:33:02
so the @suppress didn't work?
Dan Beam
2014/07/19 02:28:40
right, removed @suppress
|
| if (!obj.__lookupGetter__(name)) |
| obj.__defineGetter__(name, getGetter(name, kind)); |