pipeline and improvements
Some checks failed
Deploy Miniplan / build (push) Failing after 2m23s

This commit is contained in:
walamana
2024-08-07 20:08:52 +02:00
parent 24f14da9b2
commit dde21c3ac5
54 changed files with 1651 additions and 237 deletions

View File

@@ -0,0 +1,20 @@
import {onMounted, onUnmounted} from "vue";
export function useWindowEvent<K extends keyof WindowEventMap>(event: K, listener: (this: Window, ev: WindowEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined){
onMounted(() => {
window.addEventListener(event, listener, options as any)
})
onUnmounted(() => {
window.removeEventListener(event, listener)
})
}
export function onKeyPress(key: string, listener: () => void) {
useWindowEvent("keydown", (event) => {
if(event.key == key) {
listener()
}
})
}