Command
interface exported by @mwillbanks/tuil-core.
interface
Public interface exported by @mwillbanks/tuil-core.
export interface Command<TResult = unknown> {
readonly id: string;
readonly title: string;
readonly description?: string;
readonly category?: string;
readonly hotkeys?: readonly string[];
readonly hotkeyScope?:
| "application"
| "route"
| "focus-scope"
| "component"
| "overlay"
| "dialog";
readonly hotkeyScopeId?: string;
readonly enabled?: (context: CommandContext) => boolean | Promise<boolean>;
readonly execute: (context: CommandContext) => TResult | Promise<TResult>;
}Members
| Member | Type | Required | Description | Related types |
|---|---|---|---|---|
id | string | Yes | The id member uses the string contract. | — |
title | string | Yes | The title member uses the string contract. | — |
description | string | undefined | No | The description member uses the string | undefined contract. | — |
category | string | undefined | No | The category member uses the string | undefined contract. | — |
hotkeys | readonly string[] | undefined | No | The hotkeys member uses the readonly string[] | undefined contract. | — |
hotkeyScope | "application" | "route" | "focus-scope" | "component" | "overlay" | "dialog" | undefined | No | The hotkeyScope member uses the "application" | "route" | "focus-scope" | "component" | "overlay" | "dialog" | undefined contract. | — |
hotkeyScopeId | string | undefined | No | The hotkeyScopeId member uses the string | undefined contract. | — |
enabled | ((context: CommandContext) => boolean | Promise<boolean>) | undefined | No | The enabled member uses the ((context: CommandContext) => boolean | Promise<boolean>) | undefined contract. | CommandContext |
execute | (context: CommandContext) => TResult | Promise<TResult> | Yes | The execute member uses the (context: CommandContext) => TResult | Promise<TResult> contract. | CommandContext |
Parameters
This declaration has no public members.
Returns
This declaration does not return a value.
Throws
No thrown errors are documented for this declaration.
Related types
Source
View the secondary source reference