2022-06-30 12:35:29 +03:00
|
|
|
<template>
|
2022-08-27 17:15:11 +03:00
|
|
|
<HeaderItem />
|
|
|
|
<main class="page container">
|
|
|
|
<div class="wavelovers">
|
|
|
|
<router-view />
|
|
|
|
</div>
|
|
|
|
</main>
|
|
|
|
<FooterItem />
|
2022-06-30 12:35:29 +03:00
|
|
|
</template>
|
|
|
|
|
2022-07-14 17:50:28 +03:00
|
|
|
<script lang="ts">
|
2022-08-27 17:15:11 +03:00
|
|
|
import { defineComponent } from 'vue';
|
|
|
|
import store from '@/store/index';
|
|
|
|
import HeaderItem from '@/components/HeaderItem.vue';
|
|
|
|
import FooterItem from '@/components/FooterItem.vue';
|
2022-06-30 12:35:29 +03:00
|
|
|
|
2022-08-27 17:15:11 +03:00
|
|
|
export default defineComponent({
|
|
|
|
name: 'App',
|
|
|
|
components: {
|
|
|
|
HeaderItem: HeaderItem,
|
|
|
|
FooterItem: FooterItem,
|
|
|
|
},
|
|
|
|
methods: {
|
2022-08-27 18:53:51 +03:00
|
|
|
addGamepad: function (event: GamepadEvent): void {
|
|
|
|
store.dispatch('addGamepad', event);
|
2022-08-27 17:15:11 +03:00
|
|
|
},
|
2022-08-27 18:53:51 +03:00
|
|
|
deleteGamepad: function (event: GamepadEvent): void {
|
|
|
|
store.dispatch('deleteGamepad', event);
|
|
|
|
},
|
|
|
|
addEventListeners: function (): void {
|
|
|
|
window.addEventListener('gamepadconnected', this.addGamepad);
|
|
|
|
window.addEventListener('gamepaddisconnected', this.deleteGamepad);
|
|
|
|
},
|
|
|
|
removeEventListeners: function (): void {
|
|
|
|
window.removeEventListener('gamepadconnected', this.addGamepad);
|
|
|
|
window.removeEventListener('gamepaddisconnected', this.deleteGamepad);
|
2022-08-27 17:15:11 +03:00
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.addEventListeners();
|
|
|
|
},
|
|
|
|
unmounted() {
|
|
|
|
this.removeEventListeners();
|
|
|
|
},
|
|
|
|
});
|
2022-06-30 12:35:29 +03:00
|
|
|
</script>
|