OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 /** | 5 /** |
6 * Namespace for utility functions. | 6 * Namespace for utility functions. |
7 */ | 7 */ |
8 var util = { | 8 var util = { |
9 /** | 9 /** |
10 * Returns a function that console.log's its arguments, prefixed by |msg|. | 10 * Returns a function that console.log's its arguments, prefixed by |msg|. |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 dir.getDirectory(name, { create: true }, getOrCreateNextName, | 300 dir.getDirectory(name, { create: true }, getOrCreateNextName, |
301 errorCallback); | 301 errorCallback); |
302 } | 302 } |
303 | 303 |
304 getOrCreateNextName(root); | 304 getOrCreateNextName(root); |
305 }, | 305 }, |
306 | 306 |
307 /** | 307 /** |
308 * Lookup tables used by bytesToSi. | 308 * Lookup tables used by bytesToSi. |
309 */ | 309 */ |
310 units_: ['B', 'k', 'M', 'G', 'T', 'P'], | 310 units_: ['B', 'KB', 'MB', 'GB', 'TB', 'PB'], |
311 scale_: [1, 1e3, 1e6, 1e9, 1e12, 1e15], | 311 scale_: [1, 1e3, 1e6, 1e9, 1e12, 1e15], |
312 | 312 |
313 /** | 313 /** |
314 * Convert a number of bytes into an appropriate International System of | 314 * Convert a number of bytes into an appropriate International System of |
315 * Units (SI) representation, using the correct number separators. | 315 * Units (SI) representation, using the correct number separators. |
316 * | 316 * |
317 * The first time this function is called it computes a lookup table which | 317 * The first time this function is called it computes a lookup table which |
318 * is cached for subsequent calls. | 318 * is cached for subsequent calls. |
319 * | 319 * |
320 * @param {number} bytes The number of bytes. | 320 * @param {number} bytes The number of bytes. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 if (typeof(arg) == 'string') { | 388 if (typeof(arg) == 'string') { |
389 element.appendChild(document.createTextNode(arg)); | 389 element.appendChild(document.createTextNode(arg)); |
390 } else { | 390 } else { |
391 element.appendChild(arg); | 391 element.appendChild(arg); |
392 } | 392 } |
393 } | 393 } |
394 | 394 |
395 return element; | 395 return element; |
396 } | 396 } |
397 }; | 397 }; |
OLD | NEW |