Skip to content

Commit

Permalink
[PR] Add animation event types
Browse files Browse the repository at this point in the history
Summary:
This adds animation event types and handlers.
Closes #3340

Differential Revision: D4517481

Pulled By: jeffmo

fbshipit-source-id: b84896a2491cd6a709cd899ab7709f20c18a8ef5
  • Loading branch information
michelle-stripe authored and facebook-github-bot committed Feb 7, 2017
1 parent 5a22e8f commit a6f8432
Show file tree
Hide file tree
Showing 2 changed files with 4,453 additions and 4,446 deletions.
7 changes: 7 additions & 0 deletions lib/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,16 @@ type ProgressEventHandler = (event: ProgressEvent) => mixed
type ProgressEventListener = {handleEvent: ProgressEventHandler} | ProgressEventHandler
type DragEventHandler = (event: DragEvent) => mixed
type DragEventListener = {handleEvent: DragEventHandler} | DragEventHandler
type AnimationEventHandler = (event: AnimationEvent) => mixed
type AnimationEventListener = {handleEvent: AnimationEventHandler} | AnimationEventHandler

type MouseEventTypes = 'contextmenu' | 'mousedown' | 'mouseenter' | 'mouseleave' | 'mousemove' | 'mouseout' | 'mouseover' | 'mouseup' | 'click' | 'dblclick';
type KeyboardEventTypes = 'keydown' | 'keyup' | 'keypress';
type TouchEventTypes = 'touchstart' | 'touchmove' | 'touchend' | 'touchcancel';
type WheelEventTypes = 'wheel';
type ProgressEventTypes = 'abort' | 'error' | 'load' | 'loadend' | 'loadstart' | 'progress' | 'timeout';
type DragEventTypes = 'drag' | 'dragend' | 'dragenter' | 'dragexit' | 'dragleave' | 'dragover' | 'dragstart' | 'drop';
type AnimationEventTypes = 'animationstart' | 'animationend' | 'animationiteration';

type EventListenerOptionsOrUseCapture = boolean | {
capture?: boolean,
Expand All @@ -146,6 +149,7 @@ declare class EventTarget {
addEventListener(type: WheelEventTypes, listener: WheelEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void;
addEventListener(type: ProgressEventTypes, listener: ProgressEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void;
addEventListener(type: DragEventTypes, listener: DragEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void;
addEventListener(type: AnimationEventTypes, listener: AnimationEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void;
addEventListener(type: string, listener: EventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void;

removeEventListener(type: MouseEventTypes, listener: MouseEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void;
Expand All @@ -154,6 +158,7 @@ declare class EventTarget {
removeEventListener(type: WheelEventTypes, listener: WheelEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void;
removeEventListener(type: ProgressEventTypes, listener: ProgressEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void;
removeEventListener(type: DragEventTypes, listener: DragEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void;
removeEventListener(type: AnimationEventTypes, listener: AnimationEventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void;
removeEventListener(type: string, listener: EventListener, optionsOrUseCapture?: EventListenerOptionsOrUseCapture): void;

attachEvent?: (type: MouseEventTypes, listener: MouseEventListener) => void;
Expand All @@ -162,6 +167,7 @@ declare class EventTarget {
attachEvent?: (type: WheelEventTypes, listener: WheelEventListener) => void;
attachEvent?: (type: ProgressEventTypes, listener: ProgressEventListener) => void;
attachEvent?: (type: DragEventTypes, listener: DragEventListener) => void;
attachEvent?: (type: AnimationEventTypes, listener: AnimationEventListener) => void;
attachEvent?: (type: string, listener: EventListener) => void;

detachEvent?: (type: MouseEventTypes, listener: MouseEventListener) => void;
Expand All @@ -170,6 +176,7 @@ declare class EventTarget {
detachEvent?: (type: WheelEventTypes, listener: WheelEventListener) => void;
detachEvent?: (type: ProgressEventTypes, listener: ProgressEventListener) => void;
detachEvent?: (type: DragEventTypes, listener: DragEventListener) => void;
detachEvent?: (type: AnimationEventTypes, listener: AnimationEventListener) => void;
detachEvent?: (type: string, listener: EventListener) => void;

dispatchEvent(evt: Event): boolean;
Expand Down
Loading

0 comments on commit a6f8432

Please sign in to comment.