fantasia-archive/src/App.vue

47 lines
1 KiB
Vue
Raw Normal View History

2021-01-31 02:43:13 +13:00
<template>
<div id="q-app">
<router-view />
</div>
</template>
<script lang="ts">
import BaseClass from "src/BaseClass"
import { Component } from "vue-property-decorator"
import { defaultKeybinds } from "src/appSettings/defaultKeybinds"
2021-01-31 02:43:13 +13:00
@Component
export default class App extends BaseClass {
created () {
window.addEventListener("auxclick", this.reactToMiddleClick)
document.body.onmousedown = function (e) {
if (e.button === 1) {
e.preventDefault()
return false
}
}
this.registerDefaultKeybinds()
}
destroyed () {
window.removeEventListener("auxclick", this.reactToMiddleClick)
this.deregisterDefaultKeybinds()
}
reactToMiddleClick (e: {button: number, preventDefault: ()=> void}) {
if (e.button === 1) {
e.preventDefault()
}
}
registerDefaultKeybinds () {
defaultKeybinds.forEach(e => this.SSET_registerDefaultKeybind(e))
}
2021-01-31 02:43:13 +13:00
deregisterDefaultKeybinds () {
defaultKeybinds.forEach(e => this.SSET_deregisterDefaultKeybind(e))
}
2021-01-31 02:43:13 +13:00
}
</script>