2023-03-25 10:29:15 +00:00
|
|
|
import {QVueGlobals} from 'quasar';
|
2023-02-16 17:11:03 +00:00
|
|
|
|
2023-01-26 11:52:22 +00:00
|
|
|
export const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
|
2023-02-16 17:11:03 +00:00
|
|
|
|
|
|
|
export function showApiErrorToast(i18n: any, quasar: QVueGlobals) {
|
|
|
|
quasar.notify({
|
|
|
|
message: i18n.t('generalErrors.apiError'),
|
|
|
|
type: 'danger',
|
|
|
|
position: 'top'
|
|
|
|
});
|
|
|
|
}
|
2023-03-25 10:29:15 +00:00
|
|
|
|
|
|
|
export function showInfoToast(quasar: QVueGlobals, translatedMessage: string) {
|
|
|
|
quasar.notify({
|
|
|
|
message: translatedMessage,
|
|
|
|
type: 'info',
|
|
|
|
position: 'top'
|
|
|
|
});
|
|
|
|
}
|
2023-03-26 11:33:10 +00:00
|
|
|
|
|
|
|
export function getDocumentHeight() {
|
|
|
|
const d = document;
|
|
|
|
return Math.max(
|
|
|
|
d.body.scrollHeight, d.documentElement.scrollHeight,
|
|
|
|
d.body.offsetHeight, d.documentElement.offsetHeight,
|
|
|
|
d.body.clientHeight, d.documentElement.clientHeight
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function isScrolledToBottom(margin = 0) {
|
|
|
|
return window.scrollY + window.innerHeight + margin >= getDocumentHeight();
|
|
|
|
}
|