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

Side by Side Diff: remoting/webapp/remoting.js

Issue 10546066: Fix jscompiler error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added explanatory comment. Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7 /** @suppress {duplicate} */ 7 /** @suppress {duplicate} */
8 var remoting = remoting || {}; 8 var remoting = remoting || {};
9 9
10 /** @type {remoting.HostSession} */ remoting.hostSession = null; 10 /** @type {remoting.HostSession} */ remoting.hostSession = null;
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 298 }
299 299
300 /** 300 /**
301 * Return the current time as a formatted string suitable for logging. 301 * Return the current time as a formatted string suitable for logging.
302 * 302 *
303 * @return {string} The current time, formatted as [mmdd/hhmmss.xyz] 303 * @return {string} The current time, formatted as [mmdd/hhmmss.xyz]
304 */ 304 */
305 remoting.timestamp = function() { 305 remoting.timestamp = function() {
306 /** 306 /**
307 * @param {number} num A number. 307 * @param {number} num A number.
308 * @return {string} The number, formatted as a string of the specified length. 308 * @param {number} len The required length of the answer.
309 * @return {string} The number, formatted as a string of the specified length
310 * by prepending zeroes as necessary.
309 */ 311 */
310 var pad = function(num, len) { 312 var pad = function(num, len) {
311 var result = num.toString(); 313 var result = num.toString();
312 if (result.length < len) { 314 if (result.length < len) {
313 result = new Array(len - result.length + 1).join('0') + result; 315 result = new Array(len - result.length + 1).join('0') + result;
314 } 316 }
315 return result; 317 return result;
316 }; 318 };
317 var now = new Date(); 319 var now = new Date();
318 var timestamp = pad(now.getMonth() + 1, 2) + pad(now.getDate(), 2) + '/' + 320 var timestamp = pad(now.getMonth() + 1, 2) + pad(now.getDate(), 2) + '/' +
319 pad(now.getHours(), 2) + pad(now.getMinutes(), 2) + 321 pad(now.getHours(), 2) + pad(now.getMinutes(), 2) +
320 pad(now.getSeconds(), 2) + '.' + pad(now.getMilliseconds(), 3); 322 pad(now.getSeconds(), 2) + '.' + pad(now.getMilliseconds(), 3);
321 return '[' + timestamp + ']'; 323 return '[' + timestamp + ']';
322 }; 324 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698