function createHotkeyAttachment<T>(
hotkey,
callback,
options?
): Attachment<HTMLElement>;Defined in: packages/svelte-hotkeys/src/createHotkey.svelte.ts:111
Create an attachment for an element-scoped hotkey: a chord, a sequence, or an app hotkey that listens on the attached element. undefined, null, or '' registers nothing, for an optional shortcut.
T extends AdapterHotkeyInput
IfTypeParameter<T, MaybeGetter<T | null | undefined>, KnownHotkey<T, MaybeGetter<T | null | undefined>>>
HotkeyCallback<IfTypeParameter<T, HotkeyCallbackContext, AdapterCallbackContextFor<T>>>
IfTypeParameter<T, MaybeGetter<CreateHotkeyOptions>, MaybeGetter<[T] extends [AppHotkey<string, AppHotkeyBinding>] ? AdapterAppHotkeyOptions<Extract<T, AppHotkey<string, AppHotkeyBinding>>, CreateHotkeyTarget> : AdapterOptionsFor<T, CreateHotkeyTarget>>>
Attachment<HTMLElement>
<script lang="ts">
const saveKey = createHotkeyAttachment('Mod+S', () => save())
</script>
<div tabindex="0" {@attach saveKey}>Editor content</div>