KeyboardEvents class enables you to bind key action desired key combinations for ex., Ctrl+A, Delete, Alt+Space etc.
<div id='testEle'> </div>;
<script>
let node: HTMLElement = document.querySelector('#testEle');
let kbInstance = new KeyboardEvents({
element: node,
keyConfigs:{ selectAll : 'ctrl+a' },
keyAction: function (e:KeyboardEvent, action:string) {
// handler function code
}
});
</script>
string
Specifies on which event keyboardEvents class should listen for key press. For ex., keyup
, keydown
or keypress
Defaults to keyup
{ : }
Specifies key combination and it respective action name.
Defaults to null
Adds the handler to the given event listener.
Parameter | Type | Description |
---|---|---|
eventName | string |
A String that specifies the name of the event |
handler | Function |
Specifies the call to run when the event occurs. |
Returns void
Bind property changes immediately to components
Returns void
Unwire bound events and destroy the instance.
Returns void
Removes the handler from the given event listener.
Parameter | Type | Description |
---|---|---|
eventName | string |
A String that specifies the name of the event to remove |
handler | Function |
Specifies the function to remove |
Returns void
Specifies the listener when keyboard actions is performed.