license import { createFakeEvent , createKeyboardEvent , createMouseEvent , createTouchEvent } from './event-objects' ; /** Utility to dispatch any event on a Node. */ export function dispatchEvent ( node , event ) { node . dispatchEvent ( event ) ; return event ; } /** Shorthand to dispatch a fake event on a specified node. */ export function dispatchFakeEvent ( node , type , canBubble ? ) { return dispatchEvent ( node , typeof type === 'string' ? createFakeEvent ( type , canBubble ) : type ) ; } /** Shorthand to dispatch a keyboard event with a specified key code. */ export function dispatchKeyboardEvent ( node , type , keyCode , target ? ) { return dispatchEvent ( node , createKeyboardEvent ( type , keyCode , target ) ) as KeyboardEvent ; } /** Shorthand to dispatch a mouse event on the specified coordinates. */ export function dispatchMouseEvent ( node , type , x = 0 , y = 0 , event = createMouseEvent ( type , x , y ) ) { return dispatchEvent ( node , event ) as MouseEvent ; } /** Shorthand to dispatch a touch event on the specified coordinates. */ export function dispatchTouchEvent ( node , type , x = 0 , y = 0 ) { return dispatchEvent ( node , createTouchEvent ( type , x , y ) ) ; }