CommandHandler
Base class for command handlers.
Unlike the Obsidian Command interface, handlers are never mutated by Obsidian. The buildCommand method produces a plain Command object for registration.
Import:
import { CommandHandler } from 'obsidian-dev-utils/obsidian/command-handlers/command-handler';Signature:
export class CommandHandlerConstructor
new CommandHandler(params: CommandHandlerConstructorParams)Creates a new command handler.
Properties
| Property | Type | Description |
|---|---|---|
| icon | IconName | The icon for the command. |
| id | string | The ID of the command. |
| name | string | The display name of the command. |
Methods
| Method | Returns | Description |
|---|---|---|
| buildCommand() | Command | Builds a plain Obsidian Command object for registration. |
| onRegistered(context) | Promise<void> | Called after the command has been registered with Obsidian. Subclasses use the provided context to register menu event handlers. |
Links to this page: