本页还没有译文
本页 12 段还没译成日本語,下面显示的是英文原文。injectHotkeyRecorder
还没翻译译自英文(tanstack.com)本页 12 段都还没译
function injectHotkeyRecorder(options): AngularHotkeyRecorder;Defined in: injectHotkeyRecorder.ts:57
Angular inject-based API for recording keyboard shortcuts.
Thin wrapper around the framework-agnostic HotkeyRecorder class: captures keyboard events, converts them to hotkey strings, and handles Escape to cancel or Backspace/Delete to clear.
Parameters
options
HotkeyRecorderOptions | (() => HotkeyRecorderOptions)
Configuration options for the recorder (or getter)
Returns
Object with recording state signals and control functions
Example
@Component({ ... })
export class ShortcutSettingsComponent {
shortcut = signal<Hotkey>('Mod+S')
recorder = injectHotkeyRecorder({
onRecord: (hotkey) => this.shortcut.set(hotkey),
onCancel: () => console.log('Recording cancelled'),
})
constructor() {
injectHotkey(
() => this.shortcut(),
() => this.handleSave(),
)
}
}AI 翻译查看英文原文