@terminus/ngx-tools
Version:
[![CircleCI][circle-badge]][circle-link] [![codecov][codecov-badge]][codecov-project] [![semantic-release][semantic-release-badge]][semantic-release] [![MIT License][license-image]][license-url] <br> [![NPM version][npm-version-image]][npm-url] [![Github
16 lines (15 loc) • 646 B
TypeScript
import { KeyCode } from '@terminus/ngx-tools/keycodes';
/**
* Shorthand to dispatch a keyboard event with a specified key code
*
* @param node - The Node that should dispatch the keyboard event
* @param type - The event type
* @param key - The KeycodesConst type (contains code and keyCode)
* @param target - The target event element
* @returns The keyboard event
*
* @example
* dispatchKeyboardEvent(myNativeElement, 'keyup', ENTER);
* dispatchKeyboardEvent(myNativeElement, 'keyup', ENTER, myTargetElement);
*/
export declare const dispatchKeyboardEvent: (node: Node, type: string, key: KeyCode, target?: Element) => KeyboardEvent;