How to use the @better-scroll/core/src/__tests__/__utils__/event.createEvent function in @better-scroll/core

To help you get started, we’ve selected a few @better-scroll/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ustbhuangyi / better-scroll / packages / zoom / src / __tests__ / __utils__ / util.ts View on Github external
export function createTouchEvent(
  firstFingerPoint: { pageX: number; pageY: number },
  secondFingerPoint?: { pageX: number; pageY: number }
): CustomTouchEvent {
  const e = createEvent('Event', 'touch') as CustomTouchEvent
  e.touches = [firstFingerPoint]
  if (secondFingerPoint) {
    e.touches.push(secondFingerPoint)
  }
  return e
}