| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 // TODO(elichtenberg): Move into custom logger class or somewhere else. | 5 // TODO(elichtenberg): Move into custom logger class or somewhere else. |
| 6 let debuggingEnabled = true; | 6 let debuggingEnabled = true; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Class to handle keyboard input. | 9 * Class to handle keyboard input. |
| 10 * | 10 * |
| 11 * @constructor | 11 * @constructor |
| 12 * @param {SwitchAccessInterface} switchAccess | 12 * @param {SwitchAccessInterface} switchAccess |
| 13 */ | 13 */ |
| 14 function KeyboardHandler(switchAccess) { | 14 function KeyboardHandler(switchAccess) { |
| 15 /** | 15 /** |
| 16 * SwitchAccess reference. | 16 * SwitchAccess reference. |
| 17 * @private {SwitchAccessInterface} | 17 * @private {SwitchAccessInterface} |
| 18 */ | 18 */ |
| 19 this.switchAccess_ = switchAccess; | 19 this.switchAccess_ = switchAccess; |
| 20 | 20 |
| 21 this.init_(); | 21 this.init_(); |
| 22 }; | 22 } |
| 23 | 23 |
| 24 KeyboardHandler.prototype = { | 24 KeyboardHandler.prototype = { |
| 25 /** | 25 /** |
| 26 * Set up key listener. | 26 * Set up key listener. |
| 27 * | 27 * |
| 28 * @private | 28 * @private |
| 29 */ | 29 */ |
| 30 init_: function() { | 30 init_: function() { |
| 31 document.addEventListener('keyup', this.handleKeyEvent_.bind(this)); | 31 document.addEventListener('keyup', this.handleKeyEvent_.bind(this)); |
| 32 }, | 32 }, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 break; | 71 break; |
| 72 case '9': | 72 case '9': |
| 73 console.log('9 = go to parent element (debug mode)'); | 73 console.log('9 = go to parent element (debug mode)'); |
| 74 this.switchAccess_.debugMoveToParent(); | 74 this.switchAccess_.debugMoveToParent(); |
| 75 break; | 75 break; |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 this.switchAccess_.performedUserAction(); | 78 this.switchAccess_.performedUserAction(); |
| 79 } | 79 } |
| 80 }; | 80 }; |
| OLD | NEW |