Skip to content
docsv0.3.0

ShortcutBinding

One keyboard shortcut binding registered with a {@see \Milpa\Live\Contracts\Tui\ShortcutRegistryInterface}: a key bound to a command name within a scope.

ShortcutBinding::__construct()

public function __construct(string $key, string $command, string $label, string $scope = 'global'):

Parameters

Parameters of __construct()
NameTypeDescription
$keystringThe keypress this binding matches (registry-defined format, e.g. `'ctrl+p'`).
$commandstringThe command name to dispatch when `$key` is pressed within `$scope`.
$labelstringHuman-readable description, for a shortcut/command palette listing.
$scopestringThe scope this binding applies in; `'global'` is reachable from any scope (see {@see \Milpa\Live\Contracts\Tui\ShortcutRegistryInterface::resolve()}).

Throws

\InvalidArgumentException If `$key` or `$command` is empty.