-
Notifications
You must be signed in to change notification settings - Fork 46.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidate events between EventConstants and BrowserEventEmitter
This is a follow up to #9333. This commit removes some duplication of event names and renames the EventConstants module to BrowserEventConstants.
- Loading branch information
Showing
9 changed files
with
121 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
src/renderers/shared/shared/event/BrowserEventConstants.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/** | ||
* Copyright 2013-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
* @providesModule BrowserEventConstants | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var getVendorPrefixedEventName = require('getVendorPrefixedEventName'); | ||
|
||
export type PropagationPhases = 'bubbled' | 'captured'; | ||
|
||
/** | ||
* Types of raw signals from the browser caught at the top level. | ||
* | ||
* For events like 'submit' which don't consistently bubble (which we | ||
* trap at a lower node than `document`), binding at `document` would | ||
* cause duplicate events so we don't include them here. | ||
*/ | ||
var topLevelTypes = { | ||
topAbort: 'abort', | ||
topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend', | ||
topAnimationIteration: getVendorPrefixedEventName('animationiteration') || | ||
'animationiteration', | ||
topAnimationStart: getVendorPrefixedEventName('animationstart') || | ||
'animationstart', | ||
topBlur: 'blur', | ||
topCancel: 'cancel', | ||
topCanPlay: 'canplay', | ||
topCanPlayThrough: 'canplaythrough', | ||
topChange: 'change', | ||
topClick: 'click', | ||
topClose: 'close', | ||
topCompositionEnd: 'compositionend', | ||
topCompositionStart: 'compositionstart', | ||
topCompositionUpdate: 'compositionupdate', | ||
topContextMenu: 'contextmenu', | ||
topCopy: 'copy', | ||
topCut: 'cut', | ||
topDoubleClick: 'dblclick', | ||
topDrag: 'drag', | ||
topDragEnd: 'dragend', | ||
topDragEnter: 'dragenter', | ||
topDragExit: 'dragexit', | ||
topDragLeave: 'dragleave', | ||
topDragOver: 'dragover', | ||
topDragStart: 'dragstart', | ||
topDrop: 'drop', | ||
topDurationChange: 'durationchange', | ||
topEmptied: 'emptied', | ||
topEncrypted: 'encrypted', | ||
topEnded: 'ended', | ||
topError: 'error', | ||
topFocus: 'focus', | ||
topInput: 'input', | ||
topKeyDown: 'keydown', | ||
topKeyPress: 'keypress', | ||
topKeyUp: 'keyup', | ||
topLoadedData: 'loadeddata', | ||
topLoad: 'load', | ||
topLoadedMetadata: 'loadedmetadata', | ||
topLoadStart: 'loadstart', | ||
topMouseDown: 'mousedown', | ||
topMouseMove: 'mousemove', | ||
topMouseOut: 'mouseout', | ||
topMouseOver: 'mouseover', | ||
topMouseUp: 'mouseup', | ||
topPaste: 'paste', | ||
topPause: 'pause', | ||
topPlay: 'play', | ||
topPlaying: 'playing', | ||
topProgress: 'progress', | ||
topRateChange: 'ratechange', | ||
topScroll: 'scroll', | ||
topSeeked: 'seeked', | ||
topSeeking: 'seeking', | ||
topSelectionChange: 'selectionchange', | ||
topStalled: 'stalled', | ||
topSuspend: 'suspend', | ||
topTextInput: 'textInput', | ||
topTimeUpdate: 'timeupdate', | ||
topToggle: 'toggle', | ||
topTouchCancel: 'touchcancel', | ||
topTouchEnd: 'touchend', | ||
topTouchMove: 'touchmove', | ||
topTouchStart: 'touchstart', | ||
topTransitionEnd: getVendorPrefixedEventName('transitionend') || | ||
'transitionend', | ||
topVolumeChange: 'volumechange', | ||
topWaiting: 'waiting', | ||
topWheel: 'wheel', | ||
}; | ||
|
||
export type TopLevelTypes = $Enum<typeof topLevelTypes>; | ||
|
||
var BrowserEventConstants = { | ||
topLevelTypes, | ||
}; | ||
|
||
module.exports = BrowserEventConstants; |
Oops, something went wrong.