Trilium Frontend API
    Preparing search index...

    Class CommandCollection

    Collection of commands. Its instance is available in module:core/editor/editor~Editor#commands editor.commands.

    Implements

    Index

    Constructors

    • Creates collection instance.

      Returns CommandCollection

    Methods

    • Iterable interface.

      Returns [ commandName, commandInstance ] pairs.

      Returns Iterator<[string, Command]>

    • Registers a new command.

      Type Parameters

      • TName extends string

      Parameters

      • commandName: TName

        The name of the command.

      • command: CommandsMap[TName]

      Returns void

    • Destroys all collection commands.

      Returns void

    • Executes a command.

      Type Parameters

      • TName extends string

      Parameters

      • commandName: TName

        The name of the command.

      • ...commandParams: Parameters<CommandsMap[TName]["execute"]>

        Command parameters.

      Returns ReturnType<CommandsMap[TName]["execute"]>

      The value returned by the module:core/command~Command#execute command.execute().

    • Retrieves a command from the collection.

      Type Parameters

      • TName extends string

      Parameters

      • commandName: TName

        The name of the command.

      Returns CommandsMap[TName]

    • Returns iterator of command names.

      Returns IterableIterator<string>