Path: blob/trunk/third_party/closure/goog/events/keyevent.js
4113 views
/**1* @license2* Copyright The Closure Library Authors.3* SPDX-License-Identifier: Apache-2.04*/56/**7* @fileoverview This file contains a class for working with keyboard events8*/910goog.provide('goog.events.KeyEvent');1112goog.require('goog.events.BrowserEvent');1314/**15* This class is used for the goog.events.KeyEvent.EventType.KEY event and16* it overrides the key code with the fixed key code.17* @param {number} keyCode The adjusted key code.18* @param {number} charCode The unicode character code.19* @param {boolean} repeat Whether this event was generated by keyboard repeat.20* @param {Event} browserEvent Browser event object.21* @constructor22* @extends {goog.events.BrowserEvent}23* @final24*/25goog.events.KeyEvent = function(keyCode, charCode, repeat, browserEvent) {26'use strict';27goog.events.BrowserEvent.call(this, browserEvent);28this.type = goog.events.KeyEvent.EventType.KEY;2930/**31* Keycode of key press.32* @type {number}33*/34this.keyCode = keyCode;3536/**37* Unicode character code.38* @type {number}39*/40this.charCode = charCode;4142/**43* True if this event was generated by keyboard auto-repeat (i.e., the user is44* holding the key down.)45* @type {boolean}46*/47this.repeat = repeat;48};49goog.inherits(goog.events.KeyEvent, goog.events.BrowserEvent);5051/**52* Enum type for the events fired by the key handler53* @enum {string}54*/55goog.events.KeyEvent.EventType = {56KEY: 'key'57};585960