Function eventToString

  • Return a canonical descriptive string for a keyboard or mouse event.

    The result also contains a prefix for modifiers if any, for example "x", "F2", "Control+Home", or "Shift+clickright". This is especially useful in switch statements, to make sure that modifier keys are considered and handled correctly:

      const eventName = util.eventToString(e);
    switch (eventName) {
    case "+":
    case "Add":
    ...
    break;
    case "Enter":
    case "End":
    case "Control+End":
    case "Meta+ArrowDown":
    case "PageDown":
    ...
    break;
    }

    Parameters

    • event: Event

    Returns string