本页还没有译文
本页 13 段还没译成Deutsch,下面显示的是英文原文。createHotkeyAttachment
还没翻译译自英文(tanstack.com)本页 13 段都还没译
function createHotkeyAttachment(
hotkey,
callback,
options?): Attachment<HTMLElement>;Defined in: packages/svelte-hotkeys/src/createHotkey.svelte.ts:130
Create an attachment for element-scoped hotkeys.
Parameters
hotkey
MaybeGetter<RegisterableHotkey>
callback
HotkeyCallback
options?
MaybeGetter<CreateHotkeyOptions> = {}
Returns
Attachment<HTMLElement>
Example
<script lang="ts">
import { createHotkeyAttachment } from '@tanstack/svelte-hotkeys'
let count = $state(0)
const saveHotkey = createHotkeyAttachment('Mod+S', () => {
count++
})
</script>
<div tabindex="0" {@attach saveHotkey}>
Count: {count}
</div>
AI 翻译查看英文原文