mirror of
https://github.com/Spythere/stacjownik.git
synced 2026-05-03 13:28:11 +00:00
26 lines
521 B
TypeScript
26 lines
521 B
TypeScript
import { defineComponent } from 'vue';
|
|
|
|
export default defineComponent({
|
|
data() {
|
|
return {
|
|
preventKeyDown: false
|
|
};
|
|
},
|
|
|
|
activated() {
|
|
window.addEventListener('keydown', this.handleKeyDown);
|
|
},
|
|
|
|
deactivated() {
|
|
window.removeEventListener('keydown', this.handleKeyDown);
|
|
},
|
|
|
|
methods: {
|
|
handleKeyDown(e: KeyboardEvent) {
|
|
if (!e.key) return;
|
|
if (e.key.toLowerCase() == 'f' && !this.preventKeyDown && !e.ctrlKey && !e.altKey)
|
|
this.onKeyDownFunction();
|
|
}
|
|
}
|
|
});
|