up/down arrow start/stop timer

practiced-songs
Matthew Huntington 1 year ago
parent 404cbf12aa
commit 93c0f304a8

@ -1,7 +1,23 @@
<script setup>
import { onMounted, getCurrentInstance } from 'vue'
const currentWorkingCategory = defineModel('currentWorkingCategory')
const currentWorkingInstrument = defineModel('currentWorkingInstrument')
const props = defineProps(['categories', 'instruments'])
const { proxy } = getCurrentInstance();
onMounted(()=>{
let started = false
window.addEventListener('keydown', (event)=>{
event.preventDefault()
if(event.key === 'ArrowDown' && !started){
proxy.start()
started = true
} else if (event.key === 'ArrowUp' && started){
proxy.stop()
started = false
}
})
})
</script>
<script>
import axios from 'axios';

Loading…
Cancel
Save