Simple Svelte action wrapping @github/hotkey taking care of the lifecycle.
use:hotkey={'j'}
results in data-hotkey="j"
<script>
import { hotkey } from "svelte-gh-hotkey";
let count = 0;
</script>
<button on:click={() => count++} use:hotkey={'i'}>
Press i to increment
</button>
{count}
Run on REPL
Run locally:
cd example
npm run dev
Distributed under the MIT license. See LICENSE for details.