Skip to content

Functions

The invokey API provides a set of functions and hooks for managing keyboard shortcuts in your application. It includes support for both combination shortcuts (like Ctrl+C) and sequence shortcuts (like g g), along with a scope system for organizing and controlling shortcut groups. The API is designed to be flexible and easy to use, with TypeScript support for better development experience.

function useCombination(
combinations: string | string[],
handler: CombinationHandler,
options?: CombinationOptions
): void;

Custom hook for handling keyboard combination shortcuts

  • combinations : The combination(s) to listen for
  • handler : The function to call when the combination is matched
  • options : Configuration options for the combination
function useSequence(
sequences: string | string[],
handler: SequenceHandler,
options?: SequenceOptions
): void;

Custom hook for handling keyboard sequence

  • sequences : The sequence(s) to listen for
  • handler : The function to call when the sequence is matched
  • options : Configuration options for the sequence

Functions for managing shortcut scopes.

function enableAllScopes(): void;

Enables all scopes

function disableAllScopes(): void;

Disables all scopes

function enableScope(scope: string): void;

Enables a scope

function disableScope(scope: string): void;

Disables a scope

function toggleScope(scope: string): void;

Toggles a scope

function getActiveScopes(): string[];

Gets the active scopes

function getScopes(): Record<string, boolean>;

Gets the scopes list and their statuses