Module: ko/commands

The commands SDK allows you to register your own commands. This will allow users to connect keybindings to it.

Methods


require("ko/commands").register(commandName, command, opts)

Register a "command"

A command is a function which can be bound to a key

Example
opts = {
     label:"",
     defaultBind:"CTRL+META+B", 
     forceBind:boolean, // override any existing bindings
  }
Parameters:
Name Type Description
commandName string

Name of the command

command function

The callback

opts object

label, defaultBind, forceBind

Throws:
  • keybindings.exceptionInvalidCommandName

  • keybindings.exceptionAlreadyUsed


require("ko/commands").unregister(commandName)

Unregister the given command

Parameters:
Name Type Description
commandName string

Name of the Command