OLD | NEW |
1 /* Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2014 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 /** | 6 /** |
7 * @constructor | 7 * @constructor |
8 * @param {HTMLElement} parentDiv | 8 * @param {HTMLElement} parentDiv |
9 */ | 9 */ |
10 var ChordTracker = function(parentDiv) { | 10 var ChordTracker = function(parentDiv) { |
11 /** @type {HTMLElement} */ | 11 /** @type {HTMLElement} */ |
12 this.parentDiv_ = parentDiv; | 12 this.parentDiv_ = parentDiv; |
13 /** @type {HTMLElement} */ | 13 /** @type {HTMLElement} */ |
14 this.currentDiv_ = null; | 14 this.currentDiv_ = null; |
15 /** @type {Object.<HTMLElement>} */ | 15 /** @type {Object<HTMLElement>} */ |
16 this.pressedKeys_ = {}; | 16 this.pressedKeys_ = {}; |
17 }; | 17 }; |
18 | 18 |
19 /** | 19 /** |
20 * @param {string} code The PNaCl "code" string. | 20 * @param {string} code The PNaCl "code" string. |
21 * @param {string} title | 21 * @param {string} title |
22 * @return {void} | 22 * @return {void} |
23 */ | 23 */ |
24 ChordTracker.prototype.addKeyUpEvent = function(code, title) { | 24 ChordTracker.prototype.addKeyUpEvent = function(code, title) { |
25 var span = this.addSpanElement_('key-up', code, title); | 25 var span = this.addSpanElement_('key-up', code, title); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 /** | 107 /** |
108 * @return {boolean} True if there are any keys pressed down. | 108 * @return {boolean} True if there are any keys pressed down. |
109 * @private | 109 * @private |
110 */ | 110 */ |
111 ChordTracker.prototype.keysPressed_ = function() { | 111 ChordTracker.prototype.keysPressed_ = function() { |
112 for (var property in this.pressedKeys_) { | 112 for (var property in this.pressedKeys_) { |
113 return true; | 113 return true; |
114 } | 114 } |
115 return false; | 115 return false; |
116 }; | 116 }; |
OLD | NEW |