tuil
ReferencePackages@mwillbanks/tuil-coreAPI

Command

interface exported by @mwillbanks/tuil-core.

View rawEdit

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

MemberTypeRequiredDescriptionRelated types
idstringYesThe id member uses the string contract.
titlestringYesThe title member uses the string contract.
descriptionstring | undefinedNoThe description member uses the string | undefined contract.
categorystring | undefinedNoThe category member uses the string | undefined contract.
hotkeysreadonly string[] | undefinedNoThe hotkeys member uses the readonly string[] | undefined contract.
hotkeyScope"application" | "route" | "focus-scope" | "component" | "overlay" | "dialog" | undefinedNoThe hotkeyScope member uses the "application" | "route" | "focus-scope" | "component" | "overlay" | "dialog" | undefined contract.
hotkeyScopeIdstring | undefinedNoThe hotkeyScopeId member uses the string | undefined contract.
enabled((context: CommandContext) => boolean | Promise<boolean>) | undefinedNoThe enabled member uses the ((context: CommandContext) => boolean | Promise<boolean>) | undefined contract.CommandContext
execute(context: CommandContext) => TResult | Promise<TResult>YesThe 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.

Source

View the secondary source reference

Package

@mwillbanks/tuil-core

On this page