Keydown events action plugin for Svelte 3. Demo
Install with npm or yarn:
npm install --save svelte-actions-keydown
<svelte:window on:enter={submit} on:esc={cancel} />
<script>
import { enter, esc } from 'svelte-actions-keydown';
function submit() {
alert('Enter pressed');
}
function cancel() {
alert('Esc pressed');
}
</script>
MIT © PaulMaly