From 43b5fb7b1468bcee89271cbcfa216049137a41ef Mon Sep 17 00:00:00 2001 From: Serraniel Date: Mon, 28 Dec 2020 23:10:56 +0100 Subject: [PATCH] #48 Added types for notification enhancements --- src/javascript/enhancements/notifications.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/javascript/enhancements/notifications.ts b/src/javascript/enhancements/notifications.ts index 10df5ff..768d419 100644 --- a/src/javascript/enhancements/notifications.ts +++ b/src/javascript/enhancements/notifications.ts @@ -2,7 +2,7 @@ import { getGlobalConfiguration, SETTINGS_websiteShowNotificationsCountInTab } f import * as core from '../utils/aniwatchCore'; import * as helper from '../utils/helpers'; -export function init() { +export function init(): void { getGlobalConfiguration().getProperty(SETTINGS_websiteShowNotificationsCountInTab, value => { if (value) { core.runAfterLoad(() => { @@ -16,17 +16,17 @@ export function init() { }); } -function getNotificationCount() { +function getNotificationCount(): number { if (core.isLoggedIn()) { let menuUserText = document.getElementById('materialize-menu-dropdown').innerText.split('\n')[4]; - let notificationCount = menuUserText.match(/\d+/)?.[0] ?? 0; + let notificationCount = parseInt(menuUserText.match(/\d+/)?.[0]) ?? 0; return notificationCount; } else { return 0; } } -function updateNotificationsInTitle() { +function updateNotificationsInTitle(): void { let count = getNotificationCount(); if (helper.assigned(count) && count > 0) {