chore(vue): add eslint and prettier (#26635)

This commit is contained in:
Liam DeBeasi
2023-01-18 18:29:25 -05:00
committed by GitHub
parent 6d4c52aa5b
commit dc27736bd5
25 changed files with 5693 additions and 574 deletions

View File

@ -1,40 +1,41 @@
import { ref, Ref } from 'vue';
import type { Ref } from "vue";
import { ref } from "vue";
export interface UseKeyboardResult {
isOpen: Ref<boolean>;
keyboardHeight: Ref<number>;
unregister: () => void
unregister: () => void;
}
export const useKeyboard = (): UseKeyboardResult => {
let isOpen = ref(false);
let keyboardHeight = ref(0);
const isOpen = ref(false);
const keyboardHeight = ref(0);
const showCallback = (ev: CustomEvent) => {
isOpen.value = true;
keyboardHeight.value = ev.detail.keyboardHeight;
}
};
const hideCallback = () => {
isOpen.value = false;
keyboardHeight.value = 0;
}
};
const unregister = () => {
if (typeof (window as any) !== 'undefined') {
window.removeEventListener('ionKeyboardDidShow', showCallback);
window.removeEventListener('ionKeyboardDidHide', hideCallback);
if (typeof (window as any) !== "undefined") {
window.removeEventListener("ionKeyboardDidShow", showCallback);
window.removeEventListener("ionKeyboardDidHide", hideCallback);
}
}
};
if (typeof (window as any) !== 'undefined') {
window.addEventListener('ionKeyboardDidShow', showCallback);
window.addEventListener('ionKeyboardDidHide', hideCallback);
if (typeof (window as any) !== "undefined") {
window.addEventListener("ionKeyboardDidShow", showCallback);
window.addEventListener("ionKeyboardDidHide", hideCallback);
}
return {
isOpen,
keyboardHeight,
unregister
}
}
unregister,
};
};