2.0.0 • Published 12 months ago

ui-event-simulator v2.0.0

Weekly downloads
-
License
BSD-2-Clause
Repository
github
Last release
12 months ago

ui-event-simulator wraps the UIEvents into a easy to use functions.

Installation

npm install ui-event-simulator

Usage

import UIEventSimulator from 'ui-event-simulator'
APIDescription
fire(type, element, options)Fire a event with a specific type on a element.
fireAt(type, x, y, options)Fire a event with a specific type on a element at a certain position.

The available options can be taken from the official Event documentation Used Events.

UIEventSimulator.fire('click', document.body);
ConstantsDescription
EVENTSAll available event types.
DOM_DELTAWheelEvent - deltaMode.
console.log(UIEventSimulator.EVENTS);

Events

Special handling

  • On Chromium Browsers the click and contextmenu event is fired as a PointerEvent, all other Browsers are using MouseEvent
  • Some Browsers don't support TouchEvent for that Browsers a UIEvent is fired.

Credit

Based on the great tool happen