CommandCollection

Api-class icon class

Collection of commands. Its instance is available in editor.commands.

Properties

Methods

  • Creates collection instance.

  • Chevron-right icon

    Symbol.iterator() → Iterator<tuple>

    Iterable interface.

    Returns [ commandName, commandInstance ] pairs.

    Returns

    Iterator<tuple>
  • Chevron-right icon

    add( commandName, command ) → void

    Registers a new command.

    Type parameters

    TName : extends string

    Parameters

    commandName : TName

    The name of the command.

    command : CommandsMap[ TName ]

    Returns

    void
  • Chevron-right icon

    commands() → IterableIterator<Command>

    Returns iterator of command instances.

    Returns

    IterableIterator<Command>
  • Chevron-right icon

    destroy() → void

    Destroys all collection commands.

    Returns

    void
  • Chevron-right icon

    execute( commandName, commandParams ) → ReturnType<CommandsMap[ TName ][ 'execute' ]>

    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 command.execute().

  • Chevron-right icon

    get( commandName ) → undefined | CommandsMap[ TName ]

    Retrieves a command from the collection.

    Type parameters

    TName : extends string

    Parameters

    commandName : TName

    The name of the command.

    Returns

    undefined | CommandsMap[ TName ]
  • Chevron-right icon

    names() → IterableIterator<string>

    Returns iterator of command names.

    Returns

    IterableIterator<string>