Created with svelte.technology/repl
Created
November 25, 2018 15:01
-
-
Save mindrones/1d8a53bf15e8033a62cca847274286aa to your computer and use it in GitHub Desktop.
Pressed key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<svelte:window on:keydown="onkeydown(event)" /> | |
<div> | |
<p>Pressed key: {pressed}</p> | |
</div> | |
<script> | |
export default { | |
data () { | |
return { | |
pressed: null | |
} | |
}, | |
methods: { | |
onkeydown (event) { | |
this.set({pressed: event.key}) | |
}, | |
} | |
} | |
</script> | |
<style> | |
div { | |
width: 100%; | |
height: 100%; | |
padding: 0; | |
} | |
</style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "world" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"svelte": true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment