Search results

KeyboardEvents

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>

Properties

eventName

string

Specifies on which event keyboardEvents class should listen for key press. For ex., keyup, keydown or keypress

Defaults to keyup

keyConfigs

Object

Specifies key combination and it respective action name.

Defaults to null

Methods

addEventListener

Adds the handler to the given event listener.

Returns void

dataBind

Bind property changes immediately to components

Returns void

destroy

Unwire bound events and destroy the instance.

Returns void

removeEventListener

Removes the handler from the given event listener.

Returns void

Events

keyAction

EmitType<KeyboardEventArgs>

Specifies the listener when keyboard actions is performed.