Register command handlers in Renderer or Main process
canaryAfter declaring keymaps, you must register handlers to execute logic.
Renderer/Window (React Context)
Use this.terms.registerCommands within a decorated component to execute logic in the renderer (e.g., dispatching Redux actions). The handler receives a React key event e.
Main Process
If no renderer handler exists for a command, an rpc message is emitted. Subscribe to these messages in the main process using rpc.on('command <command-name>', callback).
// Renderer side registration
this.terms.registerCommands({
'pane:maximize': e => {
this.props.onMaximizePane();
e.preventDefault();
}
})
// Main process subscription
rpc.on('command pane:snapshot', () => {
/* Awesome snapshot feature */
});