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

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: more compiled 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..d0bf4fbb57f3526f8328dc05a70fb5b62dd059cb 100644
--- a/ui/webui/resources/js/load_time_data.js
+++ b/ui/webui/resources/js/load_time_data.js
@@ -12,12 +12,14 @@
var loadTimeData;
+// Temporary work around to expose this type globally until
+// https://github.com/google/closure-compiler/issues/544 is fixed.
+/** @constructor */
+function LoadTimeData() {}
arv (Not doing code reviews) 2014/07/16 18:33:03 I hope we are stripping this code?
Dan Beam 2014/07/19 02:28:40 we're not using the output yet, so no
+
(function() {
'use strict';
- function LoadTimeData() {
- }
-
LoadTimeData.prototype = {
/**
* Sets the backing object.
@@ -29,6 +31,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 +58,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 +88,7 @@ var loadTimeData;
getBoolean: function(id) {
var value = this.getValue(id);
expectIsType(id, value, 'boolean');
- return value;
+ return /** @type {boolean} */ (value);
},
/**
@@ -96,7 +100,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