ui-event-simulator
v2.0.0
Published
Simulate browser UI-Events
Maintainers
Readme
ui-event-simulator wraps the UIEvents into a easy to use functions.
Installation
npm install ui-event-simulatorUsage
import UIEventSimulator from 'ui-event-simulator'| API | Description |
|-------------------------------------|-------------------------------------------------------------------------|
| 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);| Constants | Description | |---------------|---------------------------------------------------------------------------------------------------| | EVENTS | All available event types. | | DOM_DELTA | WheelEvent - deltaMode. |
console.log(UIEventSimulator.EVENTS);Events
Special handling
- On Chromium Browsers the
clickandcontextmenuevent is fired as aPointerEvent, all other Browsers are usingMouseEvent - Some Browsers don't support
TouchEventfor that Browsers aUIEventis fired.
Credit
Based on the great tool happen
