Skip to content

Commit

Permalink
adds FocusEvents and UIEvents
Browse files Browse the repository at this point in the history
  • Loading branch information
Knape committed Jun 20, 2017
1 parent d81df17 commit 7e23694
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/events/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ export const eventMap = {
MouseEvent: ['click', 'dblclick', 'mouseup', 'mousedown', 'mouseenter', 'mousemove', 'mouseleave'],
KeyboardEvent: ['keypress', 'keydown', 'keyup'],
TouchEvent: ['touchstart', 'touchmove', 'touchend', 'touchcancel'],
FocusEvent: ['focus', 'blur', 'focusin', 'focusout'],
UIEvent: ['resize', 'scroll'],
CustomEvent: []
};
6 changes: 6 additions & 0 deletions src/events/event-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ export default {
'pageX',
'pageY',
'target',
],
FocusEvent: [

],
UIEvent: [

],
CustomEvent: [
'details'
Expand Down
4 changes: 4 additions & 0 deletions src/events/event.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
hasTouchEventSupport,
hasMouseEventSupport,
hasKeyboardEventSupport,
hasFocusEventSupport,
hasUIEventSupport,
hasCustomEventSupport,
} from '../utils/helpers.utils';

Expand Down Expand Up @@ -38,6 +40,8 @@ const createEventType = (
MouseEvent: (hasMouseEventSupport()) ? MouseEvent : null,
KeyboardEvent: (hasKeyboardEventSupport()) ? KeyboardEvent : null,
TouchEvent: (hasTouchEventSupport()) ? TouchEvent : null,
FocusEvent: (hasFocusEventSupport()) ? FocusEvent : null,
UIEvent: (hasUIEventSupport()) ? UIEvent : null,
CustomEvent: (hasCustomEventSupport()) ? CustomEvent : null,
};

Expand Down
2 changes: 2 additions & 0 deletions src/utils/helpers.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,6 @@ export const hasTouchSupport = () => typeof Touch !== 'undefined';
export const hasTouchEventSupport = () => typeof TouchEvent !== 'undefined';
export const hasKeyboardEventSupport = () => typeof KeyboardEvent !== 'undefined';
export const hasMouseEventSupport = () => typeof MouseEvent !== 'undefined';
export const hasFocusEventSupport = () => typeof FocusEvent !== 'undefined';
export const hasUIEventSupport = () => typeof UIEvent !== 'undefined';
export const hasCustomEventSupport = () => typeof CustomEvent !== 'undefined';

0 comments on commit 7e23694

Please sign in to comment.