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.
Functions
Section titled “Functions”useCombination
Section titled “useCombination”function useCombination( combinations: string | string[], handler: CombinationHandler, options?: CombinationOptions): void;
Custom hook for handling keyboard combination shortcuts
combinations
: The combination(s) to listen forhandler
: The function to call when the combination is matchedoptions
: Configuration options for the combination
useSequence
Section titled “useSequence”function useSequence( sequences: string | string[], handler: SequenceHandler, options?: SequenceOptions): void;
Custom hook for handling keyboard sequence
sequences
: The sequence(s) to listen forhandler
: The function to call when the sequence is matchedoptions
: Configuration options for the sequence
Scope Management
Section titled “Scope Management”Functions for managing shortcut scopes.
enableAllScopes
Section titled “enableAllScopes”function enableAllScopes(): void;
Enables all scopes
disableAllScopes
Section titled “disableAllScopes”function disableAllScopes(): void;
Disables all scopes
enableScope
Section titled “enableScope”function enableScope(scope: string): void;
Enables a scope
disableScope
Section titled “disableScope”function disableScope(scope: string): void;
Disables a scope
toggleScope
Section titled “toggleScope”function toggleScope(scope: string): void;
Toggles a scope
getActiveScopes
Section titled “getActiveScopes”function getActiveScopes(): string[];
Gets the active scopes
getScopes
Section titled “getScopes”function getScopes(): Record<string, boolean>;
Gets the scopes list and their statuses