KeyTrigger

Triggers. KeyTrigger

A trigger "key" that listens for key events in the DOM
Options:
  • event - The event to filter on, keyDown | keyPress | keyUp (Defaults to keyPress)
  • key - The key to filter on, ex. "a" or "Enter"
  • ctrl - If ctrl should be pressed or not (If omitted, then state of ctrl is not checked)
  • alt - If alt should be pressed or not (If omitted, then state of alt is not checked)
  • shift - If shift should be pressed or not (If omitted, then state of shift is not checked)
  • meta - If meta should be pressed or not (If omitted, then state of meta is not checked)
  • focus - If anything should be in focus for the event to trigger, supports concept and view
  • focus.exactConceptMatch - Should an exact match on concept be enforced. If no focus.concept is defined, the owning concept is used instead.

Constructor

new KeyTrigger()

Source:
Example
//Trigger when key "Enter" is pressed and shift is held
{
    "key": {
        "event": "keyPress",
        "key": "Enter",
        "shift": true
    }
}

//Trigger when key "Enter" is pressed and ctrl is held, and view 'myView' is in focus
{
    "key": {
        "event": "keyPress",
        "key": "Enter",
        "ctrl": true,
        "focus": {"view": "myView"}
    }
}

//Trigger when key "Enter" is pressed and ctrl is held, and view 'myView' is in focus, and owning concept matches exact on focused concept
{
    "key": {
        "event": "keyPress",
        "key": "Enter",
        "ctrl": true,
        "focus": {"view": "myView", "exactConceptMatch": true}
    }
}