From 10b057dd86897704c51a328239780bc5fed0f273 Mon Sep 17 00:00:00 2001 From: Vijay A Date: Fri, 3 Dec 2021 04:35:58 +0530 Subject: fix: fix javascript error in 'circuit' recipe --- recipes/circuit/webview.js | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'recipes/circuit/webview.js') diff --git a/recipes/circuit/webview.js b/recipes/circuit/webview.js index b5e3fd5..8cd2e2f 100644 --- a/recipes/circuit/webview.js +++ b/recipes/circuit/webview.js @@ -1,23 +1,12 @@ -"use strict"; - module.exports = Ferdi => { const getMessages = function getMessages() { - // Initialize empty vars - var match = []; // Get value of tag where in case of new messages the number of messages appear const titleValue = document.querySelector('title').text; - // Extract the number from the tag - match = titleValue.match(/\d+/); - unread = match != null && match.length > 0 ? match[0] : 0; - // Set unread msgs badge + const match = titleValue.match(/\d+/); + const unread = match != null && match.length > 0 ? match[0] : 0; Ferdi.setBadge(Ferdi.safeParseInt(unread)); }; - const loopFunc = () => { - getMessages(); - }; - - Ferdi.loop(loopFunc); - + Ferdi.loop(getMessages); }; -- cgit v1.2.3-70-g09d2