CommandHandlerComponent.registerCommandHandlers method
CommandHandlerComponent › registerCommandHandlers
Builds the command handlers and registers them with Obsidian, giving each its own runtime registration context. Each handler's command is added immediately; the returned DisposableEx removes the commands registered by this call — and any menu events those handlers registered via their context's MenuEventRegistrar — when disposed. Any command still registered when the component unloads is removed automatically.The factory is invoked once more for every additional menu surface, so a plugin declares its handlers ONCE and all surfaces are fed. Those extra passes add no commands — the palette already has every command from the first pass.
Signature:
registerCommandHandlers(commandHandlerFactory: CommandHandlerFactory): Promise<DisposableEx>Parameters:
| Parameter | Type | Description |
|---|---|---|
| commandHandlerFactory | CommandHandlerFactory | Builds a fresh set of command handlers, once per menu surface. |
Returns: Promise<DisposableEx> — A DisposableEx that unregisters the handlers (commands + menu events) registered by this call.