Skip to content

GlobalCommandHandler

Command handler for global commands invoked from the command palette.

Subclasses override canExecute and execute to provide behavior.

Import:

import { GlobalCommandHandler } from 'obsidian-dev-utils/obsidian/command-handlers/global-command-handler';

Signature:

export class GlobalCommandHandler extends CommandHandler

Extends: CommandHandler

Constructor

new GlobalCommandHandler(params: CommandHandlerConstructorParams)

Creates a new global command handler.

Properties

PropertyTypeDescription
iconIconNameThe icon for the command.
(Inherited from CommandHandler)
idstringThe ID of the command.
(Inherited from CommandHandler)
namestringThe display name of the command.
(Inherited from CommandHandler)

Methods

MethodReturnsDescription
buildCommand()CommandBuilds a plain Obsidian Command object with a checkCallback.
canExecute()booleanChecks whether the command can currently execute.
execute()Promisable<void>Executes the command.
onRegistered(context)Promise<void>Called after the command has been registered with Obsidian. Subclasses use the provided context to register menu event handlers.
(Inherited from CommandHandler)

Links to this page: