Docs
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
CodeRabbit
Cloudflare
AG Grid
SerpAPI
Netlify
OpenRouter
Neon
WorkOS
Clerk
Electric
PowerSync
Sentry
Railway
Prisma
Strapi
Unkey
Hotkeys API Reference
App Hotkeys API Reference
Key hold & held keys API Reference
Hotkey Recorder API Reference
Normalization & format API Reference
Hotkeys API Reference

injectHotkeys

ts
function injectHotkeys(hotkeys, commonOptions?): void;
function injectHotkeys(hotkeys, commonOptions?): void;

Defined in: injectHotkeys.ts:36

Angular inject-based API for registering several hotkeys at once: chords, sequences, and app hotkeys. Pass a getter for a reactive list.

Options merge in this order: provider defaults, app hotkey declaration, commonOptions, per-hotkey options. Each option applies only to the kinds that support it. Unbound app hotkeys and empty sequences register nothing. A null target skips registration until it is set.

Parameters

hotkeys

| readonly InjectHotkeyDefinition[] | (() => readonly InjectHotkeyDefinition[])

commonOptions?

| InjectHotkeyCommonOptions | (() => InjectHotkeyCommonOptions)

Returns

void

Example

ts
injectHotkeys([
  { hotkey: 'Mod+S', callback: () => this.save() },
  { hotkey: ['G', 'G'], callback: () => this.scrollToTop(), options: { timeout: 500 } },
])
injectHotkeys([
  { hotkey: 'Mod+S', callback: () => this.save() },
  { hotkey: ['G', 'G'], callback: () => this.scrollToTop(), options: { timeout: 500 } },
])