function injectHotkey<T>(
hotkey,
callback,
options?): void;Defined in: injectHotkey.ts:70
Angular inject-based API for registering a hotkey: a chord such as 'Mod+S', a sequence such as ['G', 'G'], or an app hotkey from defineAppHotkeys. The hotkey and options may be getters that read signals.
Chords accept requireReset; sequences accept timeout. A one-step sequence registers as its chord. An app hotkey uses its effective hotkey from provideHotkeys (including the user's custom hotkey) and its declared meta and options, and registers nothing while unbound.
T extends AppHotkey<string, HotkeyChord | HotkeySequence | null>
MaybeGetter<T>
HotkeyCallback
MaybeGetter<InjectAppHotkeyOptions<T>>
void
@Component({ ... })
export class EditorComponent {
constructor() {
injectHotkey('Mod+S', () => this.save())
injectHotkey(['G', 'G'], () => this.scrollToTop(), { timeout: 500 })
injectHotkey('Escape', () => this.close(), () => ({ enabled: this.isOpen() }))
}
}function injectHotkey<T>(
hotkey,
callback,
options?): void;Defined in: injectHotkey.ts:75
Angular inject-based API for registering a hotkey: a chord such as 'Mod+S', a sequence such as ['G', 'G'], or an app hotkey from defineAppHotkeys. The hotkey and options may be getters that read signals.
Chords accept requireReset; sequences accept timeout. A one-step sequence registers as its chord. An app hotkey uses its effective hotkey from provideHotkeys (including the user's custom hotkey) and its declared meta and options, and registers nothing while unbound.
T extends RegisterableHotkey
MaybeGetter<T>
HotkeyCallback<HotkeyCallbackContextFor<T>>
MaybeGetter<AdapterOptionsFor<T, InjectHotkeyTarget>>
void
@Component({ ... })
export class EditorComponent {
constructor() {
injectHotkey('Mod+S', () => this.save())
injectHotkey(['G', 'G'], () => this.scrollToTop(), { timeout: 500 })
injectHotkey('Escape', () => this.close(), () => ({ enabled: this.isOpen() }))
}
}