Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/netzo/deps/question/KeyCombo.ts>default.parse

Full-stack Deno framework for building business web apps like internal tools, dashboards, admin panels and automated workflows.
Go to Latest
method default.parse
import { default } from "https://deno.land/x/netzo@0.5.107/deps/question/KeyCombo.ts";

Parses a key combination from a string. The string should be in a format of modifier keys and then an actual key. To separate different keys use a plus (+). Modifier keys are Ctrl, Shift, Alt (Option), and the meta key. The meta modifier key is represented as windows logo, or on mac the text command, can be represented as Command, Super, or Win.

Examples

Example 1

const combinations = [
  KeyCombo.parse('Ctrl+s'),
  KeyCombo.parse('Ctrl'),
  KeyCombo.parse('Ctrl+Shift+Esc'),
  KeyCombo.parse('Ctrl+Alt+Delete'),
]

Parameters

str: string

The key combination string.

Returns

KeyCombo

The key combination instance parsed from the string.