Terminal Focus

This section is about the focus functionality of the Terminal.

getFocusedTerminalId

Returns the ID of the focused terminal.

Copy
getFocusedTerminalId(state: Object): String;
  • state Object

    Required. The global state of the application.

Returns
  • String

    The ID of the focused terminal.

Example
Copy
const state = storeHelper.getState();
const getFocusedTerminalId = selectorsHelper.make('getFocusedTerminalId');
const focusedTerminalId = getFocusedTerminalId(state);

isTerminalFocused

Returns a true or false depending if the terminal specified is focused.

Copy
isTerminalFocused(state: Object, { terminalId: String }): Boolean;
  • state Object

    Required. The global state of the application.

  • terminalId String

    Required. The ID of the terminal to be checked.

Returns

Boolean

True if the terminal is focused. False if the terminal is not focused.

Example
Copy
const state = storeHelper.getState();
const isTerminalFocused = selectorsHelper.make('isTerminalFocused');
const isFocused = isTerminalFocused(state, { terminalId: 'terminal-1' });

focusTerminal

Focus the specified terminal.

Note: Dispatches an action with the type @orion/terminals-helper/FOCUS_TERMINAL which can be handled.
Usage
Copy
dispatchersHelper.dispatch('focusTerminal', { terminalId: String });
  • terminalId String

  • Required. The ID of the terminal to focus.

Example
Copy
dispatchersHelper.dispatch('focusTerminal', { terminalId: 'terminal-1' });

blurTerminal

Blur the specified terminal.

Note: Dispatches an action with the type @orion/terminals-helper/BLUR_TERMINAL which can be handled
Usage
Copy
dispatchersHelper.dispatch('blurTerminal', { terminalId: String });
  • terminalId String

    Required. The id of the terminal to blur.

Example
Copy
dispatchersHelper.dispatch('blurTerminal', { terminalId: 'terminal-1' });