eventHandlers.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /**
  2. * Common event handlers for JSX element event binding.
  3. */
  4. const eventHandlersByType = {
  5. clipboard: [
  6. 'onCopy',
  7. 'onCut',
  8. 'onPaste',
  9. ],
  10. composition: [
  11. 'onCompositionEnd',
  12. 'onCompositionStart',
  13. 'onCompositionUpdate',
  14. ],
  15. keyboard: [
  16. 'onKeyDown',
  17. 'onKeyPress',
  18. 'onKeyUp',
  19. ],
  20. focus: [
  21. 'onFocus',
  22. 'onBlur',
  23. ],
  24. form: [
  25. 'onChange',
  26. 'onInput',
  27. 'onSubmit',
  28. ],
  29. mouse: [
  30. 'onClick',
  31. 'onContextMenu',
  32. 'onDblClick',
  33. 'onDoubleClick',
  34. 'onDrag',
  35. 'onDragEnd',
  36. 'onDragEnter',
  37. 'onDragExit',
  38. 'onDragLeave',
  39. 'onDragOver',
  40. 'onDragStart',
  41. 'onDrop',
  42. 'onMouseDown',
  43. 'onMouseEnter',
  44. 'onMouseLeave',
  45. 'onMouseMove',
  46. 'onMouseOut',
  47. 'onMouseOver',
  48. 'onMouseUp',
  49. ],
  50. selection: [
  51. 'onSelect',
  52. ],
  53. touch: [
  54. 'onTouchCancel',
  55. 'onTouchEnd',
  56. 'onTouchMove',
  57. 'onTouchStart',
  58. ],
  59. ui: [
  60. 'onScroll',
  61. ],
  62. wheel: [
  63. 'onWheel',
  64. ],
  65. media: [
  66. 'onAbort',
  67. 'onCanPlay',
  68. 'onCanPlayThrough',
  69. 'onDurationChange',
  70. 'onEmptied',
  71. 'onEncrypted',
  72. 'onEnded',
  73. 'onError',
  74. 'onLoadedData',
  75. 'onLoadedMetadata',
  76. 'onLoadStart',
  77. 'onPause',
  78. 'onPlay',
  79. 'onPlaying',
  80. 'onProgress',
  81. 'onRateChange',
  82. 'onSeeked',
  83. 'onSeeking',
  84. 'onStalled',
  85. 'onSuspend',
  86. 'onTimeUpdate',
  87. 'onVolumeChange',
  88. 'onWaiting',
  89. ],
  90. image: [
  91. 'onLoad',
  92. 'onError',
  93. ],
  94. animation: [
  95. 'onAnimationStart',
  96. 'onAnimationEnd',
  97. 'onAnimationIteration',
  98. ],
  99. transition: [
  100. 'onTransitionEnd',
  101. ],
  102. };
  103. const eventHandlers = Object.keys(eventHandlersByType).reduce(
  104. (accumulator, type) => accumulator.concat(eventHandlersByType[type]),
  105. [],
  106. );
  107. export default eventHandlers;
  108. export { eventHandlersByType };