Skip to content

Commit

Permalink
Experimental event API: refactor responder modules for lifecycle incl…
Browse files Browse the repository at this point in the history
…usion (#15322)
  • Loading branch information
trueadm authored Apr 4, 2019
1 parent 937d262 commit b93a8a9
Show file tree
Hide file tree
Showing 11 changed files with 485 additions and 478 deletions.
40 changes: 23 additions & 17 deletions packages/events/EventTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,40 @@
import type {AnyNativeEvent} from 'events/PluginModuleType';
import type {ReactEventResponderEventType} from 'shared/ReactTypes';

export type EventResponderContext = {
event: AnyNativeEvent,
eventTarget: Element | Document,
eventType: string,
isPassive: () => boolean,
isPassiveSupported: () => boolean,
dispatchEvent: <E>(
eventObject: E,
{
capture?: boolean,
discrete?: boolean,
stopPropagation?: boolean,
},
export type ResponderEvent = {
nativeEvent: AnyNativeEvent,
target: Element | Document,
type: string,
passive: boolean,
passiveSupported: boolean,
};

export type ResponderDispatchEventOptions = {
capture?: boolean,
discrete?: boolean,
stopPropagation?: boolean,
};

export type ResponderContext = {
dispatchEvent: (
eventObject: Object,
otpions: ResponderDispatchEventOptions,
) => void,
isTargetWithinElement: (
childTarget: Element | Document,
parentTarget: Element | Document,
) => boolean,
isTargetOwned: (Element | Document) => boolean,
isTargetWithinEventComponent: (Element | Document) => boolean,
isPositionWithinTouchHitTarget: (x: number, y: number) => boolean,
addRootEventTypes: (
document: Document,
rootEventTypes: Array<ReactEventResponderEventType>,
) => void,
removeRootEventTypes: (
rootEventTypes: Array<ReactEventResponderEventType>,
) => void,
requestOwnership: (target: Element | Document | null) => boolean,
releaseOwnership: (target: Element | Document | null) => boolean,
withAsyncDispatching: (func: () => void) => void,
hasOwnership: () => boolean,
requestOwnership: () => boolean,
releaseOwnership: () => boolean,
setTimeout: (func: () => void, timeout: number) => TimeoutID,
};
Loading

0 comments on commit b93a8a9

Please sign in to comment.