release v2.0.0 #4

Merged
crimsen merged 481 commits from develop into master 2024-01-18 15:15:08 +00:00
1 changed files with 15 additions and 14 deletions
Showing only changes of commit f787e314ef - Show all commits

View File

@ -135,7 +135,10 @@ export default defineComponent({
const useNative = 'Notification' in window && window.Notification !== undefined; const useNative = 'Notification' in window && window.Notification !== undefined;
const noPermission = ref(!useNative || window.Notification.permission !== 'granted'); const noPermission = ref(!useNative || window.Notification.permission !== 'granted');
onBeforeMount(() => pollNotification()); onBeforeMount(() => {
polling.value = window.setInterval(() => pollNotification(), config.pollingInterval);
pollNotification();
});
onBeforeUnmount(() => window.clearInterval(polling.value)); onBeforeUnmount(() => window.clearInterval(polling.value));
const leftDrawerOpen = computed({ const leftDrawerOpen = computed({
@ -170,19 +173,17 @@ export default defineComponent({
} }
function pollNotification() { function pollNotification() {
polling.value = window.setInterval(() => { void mainStore
void mainStore .loadNotifications(<FG_Plugin.Flaschengeist>flaschengeist)
.loadNotifications(<FG_Plugin.Flaschengeist>flaschengeist) .then((notifications) => {
.then((notifications) => { if (useNative && !noPermission.value)
if (useNative && !noPermission.value) notifications.forEach(
notifications.forEach( (notif) =>
(notif) => new window.Notification(notif.text, {
new window.Notification(notif.text, { timestamp: notif.time.getTime(),
timestamp: notif.time.getTime(), })
}) );
); });
});
}, config.pollingInterval);
} }
return { return {