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
App Hotkeys API Reference

provideAppHotkeys

ts
function provideAppHotkeys<T>(appHotkeys, options?): object;
function provideAppHotkeys<T>(appHotkeys, options?): object;

Defined in: app-hotkeys.ts:582

Creates an app hotkeys store and publishes it on the HotkeyManager, for adapters without a provider component (such as Lit and Alpine). Hotkey APIs in those adapters resolve app hotkeys and custom hotkeys from the published store. Call it once at startup. Returns the store and a function that unpublishes it.

Type Parameters

T

T extends Readonly<Record<string, AppHotkey<string, | HotkeyChord | HotkeySequence | null>>>

Parameters

appHotkeys

T

options?

AppHotkeysStoreOptions<T> = {}

Returns

object

dispose

ts
dispose: () => void;
dispose: () => void;

Returns

void

store

ts
store: AppHotkeysStore<T>;
store: AppHotkeysStore<T>;

Example

ts
provideAppHotkeys(appHotkeys, {
  customHotkeys: JSON.parse(localStorage.getItem('hotkeys') ?? '{}'),
  onCustomHotkeysChange: (custom) =>
    localStorage.setItem('hotkeys', JSON.stringify(custom)),
})
provideAppHotkeys(appHotkeys, {
  customHotkeys: JSON.parse(localStorage.getItem('hotkeys') ?? '{}'),
  onCustomHotkeysChange: (custom) =>
    localStorage.setItem('hotkeys', JSON.stringify(custom)),
})