Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Unified Diff: ui/webui/resources/js/cr.js

Issue 369643002: Lay groudwork to Closure compile JavaScript (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: asdf Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.
*/
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.
*/
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);
if (!obj.__lookupGetter__(name))
obj.__defineGetter__(name, getGetter(name, kind));

Powered by Google App Engine
This is Rietveld 408576698