Defined in: app-hotkeys.ts:350
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:355
T
AppHotkeysStoreOptions<T> = {}
AppHotkeysStore<T>
readonly store: Store<AppHotkeysState<T>>;Defined in: app-hotkeys.ts:351
get appHotkeys(): T;Defined in: app-hotkeys.ts:373
Effective app hotkeys.
T
get customHotkeys(): CustomHotkeys<T>;Defined in: app-hotkeys.ts:378
The user's hotkeys that differ from the defaults.
findConflicts(id, hotkey): AppHotkey<string,
| HotkeyChord
| HotkeySequence
| null>[];Defined in: app-hotkeys.ts:414
Other app hotkeys that would collide if id used hotkey. App hotkeys collide when their contexts match or either has no context, 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:405
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:481
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:458
Restores the default hotkey for an app hotkey.
keyof T & string
void
resetCustomHotkeys(): void;Defined in: app-hotkeys.ts:465
Restores every default hotkey.
void
setAppHotkeys(appHotkeys): void;Defined in: app-hotkeys.ts:391
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:433
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:383
Updates callbacks and other options without resetting custom hotkeys.
Omit<AppHotkeysStoreOptions<T>, "customHotkeys">
void