版博士V2.0程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

KeyboardEvent.js 1.5 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. "use strict";
  2. var __importDefault = (this && this.__importDefault) || function (mod) {
  3. return (mod && mod.__esModule) ? mod : { "default": mod };
  4. };
  5. Object.defineProperty(exports, "__esModule", { value: true });
  6. const UIEvent_1 = __importDefault(require("../UIEvent"));
  7. /**
  8. *
  9. */
  10. class KeyboardEvent extends UIEvent_1.default {
  11. /**
  12. * Constructor.
  13. *
  14. * @param type Event type.
  15. * @param [eventInit] Event init.
  16. */
  17. constructor(type, eventInit = null) {
  18. super(type, eventInit);
  19. this.altKey = false;
  20. this.code = '';
  21. this.ctrlKey = false;
  22. this.isComposing = false;
  23. this.key = '';
  24. this.location = 0;
  25. this.metaKey = false;
  26. this.repeat = false;
  27. this.shiftKey = false;
  28. if (eventInit) {
  29. this.altKey = eventInit.altKey || false;
  30. this.code = eventInit.code || '';
  31. this.ctrlKey = eventInit.ctrlKey || false;
  32. this.isComposing = eventInit.isComposing || false;
  33. this.key = eventInit.key || '';
  34. this.location = eventInit.location !== undefined ? eventInit.location : 0;
  35. this.metaKey = eventInit.metaKey || false;
  36. this.repeat = eventInit.repeat || false;
  37. this.shiftKey = eventInit.shiftKey || false;
  38. }
  39. }
  40. }
  41. exports.default = KeyboardEvent;
  42. KeyboardEvent.DOM_KEY_LOCATION_STANDARD = 0;
  43. KeyboardEvent.DOM_KEY_LOCATION_LEFT = 1;
  44. KeyboardEvent.DOM_KEY_LOCATION_RIGHT = 2;
  45. KeyboardEvent.DOM_KEY_LOCATION_NUMPAD = 3;
  46. //# sourceMappingURL=KeyboardEvent.js.map