Defined in: app-hotkeys.ts:352
Holds declared app hotkeys and the user's custom hotkeys. Framework providers create one and expose it through hooks; devtools read it from HotkeyManager.appHotkeys.
const store = new AppHotkeysStore(appHotkeys, {
customHotkeys: JSON.parse(localStorage.getItem('hotkeys') ?? '{}'),
onCustomHotkeysChange: (custom) =>
localStorage.setItem('hotkeys', JSON.stringify(custom)),
})
store.setCustomHotkey('doc.save', 'Mod+Shift+S')T extends AppHotkeys = AppHotkeys
new AppHotkeysStore<T>(appHotkeys, options?): AppHotkeysStore<T>;Defined in: app-hotkeys.ts:357
T
AppHotkeysStoreOptions<T> = {}
AppHotkeysStore<T>
readonly store: Store<AppHotkeysState<T>>;Defined in: app-hotkeys.ts:353
get appHotkeys(): T;Defined in: app-hotkeys.ts:375
Effective app hotkeys.
T
get customHotkeys(): CustomHotkeys<T>;Defined in: app-hotkeys.ts:380
The user's hotkeys that differ from the defaults.
findConflicts(id, hotkey): AppHotkey<string,
| HotkeyChord
| HotkeySequence
| null>[];Defined in: app-hotkeys.ts:416
Other app hotkeys that would collide if id used hotkey. App hotkeys collide when their scopes match or either is 'global', and their hotkeys are equal or one sequence starts with the other.
keyof T & string
AppHotkey<string, | HotkeyChord | HotkeySequence | null>[]
get(id):
| AppHotkey<string,
| HotkeyChord
| HotkeySequence
| null>
| undefined;Defined in: app-hotkeys.ts:407
Effective app hotkey for an id, or undefined when it is not declared.
string
| AppHotkey<string, | HotkeyChord | HotkeySequence | null> | undefined
getList(registrations): AppHotkeyListItem<T[keyof T]>[];Defined in: app-hotkeys.ts:483
Joins app hotkeys with live registrations, in declaration order. Adapters call this with the manager's registration views.
Iterable<HotkeyRegistrationView>
AppHotkeyListItem<T[keyof T]>[]
resetCustomHotkey(id): void;Defined in: app-hotkeys.ts:460
Restores the default hotkey for an app hotkey.
keyof T & string
void
resetCustomHotkeys(): void;Defined in: app-hotkeys.ts:467
Restores every default hotkey.
void
setAppHotkeys(appHotkeys): void;Defined in: app-hotkeys.ts:393
Replaces the declarations, for example after hot module replacement. Custom hotkeys for ids that still exist are kept.
T
void
setCustomHotkey(id, hotkey): AppHotkey<string,
| HotkeyChord
| HotkeySequence
| null>[];Defined in: app-hotkeys.ts:435
Sets the user's hotkey for an app hotkey. null unbinds it. A hotkey equal to the default removes the customization.
keyof T & string
Hotkey | null
AppHotkey<string, | HotkeyChord | HotkeySequence | null>[]
Conflicting app hotkeys. When any exist, nothing changes.
setOptions(options): void;Defined in: app-hotkeys.ts:385
Updates callbacks and other options without resetting custom hotkeys.
Omit<AppHotkeysStoreOptions<T>, "customHotkeys">
void