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

Unified Diff: ui/webui/resources/js/load_time_data.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/load_time_data.js
diff --git a/ui/webui/resources/js/load_time_data.js b/ui/webui/resources/js/load_time_data.js
index ee3d497d654cbc1d6729f96f83d5426039896992..a7efcdbb3ed52f6e7cc8333ce43e95cf2fbcc2fe 100644
--- a/ui/webui/resources/js/load_time_data.js
+++ b/ui/webui/resources/js/load_time_data.js
@@ -15,6 +15,7 @@ var loadTimeData;
(function() {
'use strict';
+ /** @constructor */
function LoadTimeData() {
}
@@ -29,6 +30,7 @@ var loadTimeData;
},
/**
+ * @param {string} id An ID of a value that might exist.
* @return {boolean} True if |id| is a key in the dictionary.
*/
valueExists: function(id) {
@@ -55,20 +57,21 @@ var loadTimeData;
getString: function(id) {
var value = this.getValue(id);
expectIsType(id, value, 'string');
- return value;
+ return /** @type {string} */ (value);
},
/**
* Returns a formatted localized string where $1 to $9 are replaced by the
* second to the tenth argument.
* @param {string} id The ID of the string we want.
- * @param {...string} The extra values to include in the formatted output.
+ * @param {...string} var_args The extra values to include in the formatted
+ * output.
* @return {string} The formatted string.
*/
- getStringF: function(id) {
+ getStringF: function(id, var_args) {
var value = this.getString(id);
if (!value)
- return;
+ return '';
var varArgs = arguments;
return value.replace(/\$[$1-9]/g, function(m) {
@@ -84,7 +87,7 @@ var loadTimeData;
getBoolean: function(id) {
var value = this.getValue(id);
expectIsType(id, value, 'boolean');
- return value;
+ return /** @type {boolean} */ (value);
},
/**
@@ -96,7 +99,7 @@ var loadTimeData;
var value = this.getValue(id);
expectIsType(id, value, 'number');
expect(value == Math.floor(value), 'Number isn\'t integer: ' + value);
- return value;
+ return /** @type {number} */ (value);
},
/**

Powered by Google App Engine
This is Rietveld 408576698