Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
SeleniumHQ
GitHub Repository: SeleniumHQ/Selenium
Path: blob/trunk/third_party/closure/goog/events/keyevent.js
4113 views
1
/**
2
* @license
3
* Copyright The Closure Library Authors.
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
/**
8
* @fileoverview This file contains a class for working with keyboard events
9
*/
10
11
goog.provide('goog.events.KeyEvent');
12
13
goog.require('goog.events.BrowserEvent');
14
15
/**
16
* This class is used for the goog.events.KeyEvent.EventType.KEY event and
17
* it overrides the key code with the fixed key code.
18
* @param {number} keyCode The adjusted key code.
19
* @param {number} charCode The unicode character code.
20
* @param {boolean} repeat Whether this event was generated by keyboard repeat.
21
* @param {Event} browserEvent Browser event object.
22
* @constructor
23
* @extends {goog.events.BrowserEvent}
24
* @final
25
*/
26
goog.events.KeyEvent = function(keyCode, charCode, repeat, browserEvent) {
27
'use strict';
28
goog.events.BrowserEvent.call(this, browserEvent);
29
this.type = goog.events.KeyEvent.EventType.KEY;
30
31
/**
32
* Keycode of key press.
33
* @type {number}
34
*/
35
this.keyCode = keyCode;
36
37
/**
38
* Unicode character code.
39
* @type {number}
40
*/
41
this.charCode = charCode;
42
43
/**
44
* True if this event was generated by keyboard auto-repeat (i.e., the user is
45
* holding the key down.)
46
* @type {boolean}
47
*/
48
this.repeat = repeat;
49
};
50
goog.inherits(goog.events.KeyEvent, goog.events.BrowserEvent);
51
52
/**
53
* Enum type for the events fired by the key handler
54
* @enum {string}
55
*/
56
goog.events.KeyEvent.EventType = {
57
KEY: 'key'
58
};
59
60