Skip to content

Commit

Permalink
Migrate hook touch props to TS
Browse files Browse the repository at this point in the history
  • Loading branch information
Rochmar Nicolas (DevExpress) committed Jul 23, 2024
1 parent 57c0645 commit d93ebc6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
28 changes: 13 additions & 15 deletions packages/devextreme/js/__internal/events/core/m_hook_touch_props.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
const touchPropsToHook = ['pageX', 'pageY', 'screenX', 'screenY', 'clientX', 'clientY'];
const touchPropHook = function(name, event) {
if(event[name] && !event.touches || !event.touches) {
return event[name];
}
const touchPropHook = function (name, event) {
if (event[name] && !event.touches || !event.touches) {
return event[name];
}

const touches = event.touches.length ? event.touches : event.changedTouches;
if(!touches.length) {
return;
}
const touches = event.touches.length ? event.touches : event.changedTouches;
if (!touches.length) {
return;
}

return touches[0][name];
return touches[0][name];
};

export default function(callback) {
touchPropsToHook.forEach(function(name) {
callback(name, function(event) {
return touchPropHook(name, event);
});
}, this);
export default function (callback) {
touchPropsToHook.forEach((name) => {
callback(name, (event) => touchPropHook(name, event));
}, this);
}
1 change: 1 addition & 0 deletions packages/devextreme/js/events/core/hook_touch_props.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from '../../__internal/events/core/m_hook_touch_props';

0 comments on commit d93ebc6

Please sign in to comment.