OLD | NEW |
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 /** | 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 * modifiers. Convenient for writing out conditions in keyboard handlers. | 484 * modifiers. Convenient for writing out conditions in keyboard handlers. |
485 * | 485 * |
486 * @param {Event} event | 486 * @param {Event} event |
487 * @return {string} | 487 * @return {string} |
488 */ | 488 */ |
489 getKeyModifiers: function(event) { | 489 getKeyModifiers: function(event) { |
490 return (event.ctrlKey ? 'Ctrl-' : '') + | 490 return (event.ctrlKey ? 'Ctrl-' : '') + |
491 (event.altKey ? 'Alt-' : '') + | 491 (event.altKey ? 'Alt-' : '') + |
492 (event.shiftKey ? 'Shift-' : '') + | 492 (event.shiftKey ? 'Shift-' : '') + |
493 (event.metaKey ? 'Meta-' : ''); | 493 (event.metaKey ? 'Meta-' : ''); |
| 494 }, |
| 495 |
| 496 /** |
| 497 * A wrapper for navigator.onLine that allows for easy debug override. |
| 498 * @return {boolean} True if offline. |
| 499 */ |
| 500 isOffline: function() { |
| 501 return !navigator.onLine; |
494 } | 502 } |
495 }; | 503 }; |
OLD | NEW |