aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/slite
diff options
context:
space:
mode:
authorLibravatar Vijay A <avijayr@protonmail.com>2021-08-31 16:25:57 +0530
committerLibravatar Vijay A <avijayr@protonmail.com>2021-08-31 16:25:57 +0530
commitdfae2d231e39c81827d08fd8834d736c5b3005b1 (patch)
tree5037b401e7de837fdd6046a3c61ac76aed240e6e /recipes/slite
parentNew recipe: odoo (diff)
downloadferdium-recipes-dfae2d231e39c81827d08fd8834d736c5b3005b1.tar.gz
ferdium-recipes-dfae2d231e39c81827d08fd8834d736c5b3005b1.tar.zst
ferdium-recipes-dfae2d231e39c81827d08fd8834d736c5b3005b1.zip
refactor: Use Ferdi.safeParseInt to ensure that parsing is done consistently in all recipes.
Diffstat (limited to 'recipes/slite')
-rw-r--r--recipes/slite/package.json2
-rw-r--r--recipes/slite/webview.js12
2 files changed, 3 insertions, 11 deletions
diff --git a/recipes/slite/package.json b/recipes/slite/package.json
index 5c38982..44ec123 100644
--- a/recipes/slite/package.json
+++ b/recipes/slite/package.json
@@ -1,7 +1,7 @@
1{ 1{
2 "id": "slite", 2 "id": "slite",
3 "name": "Slite", 3 "name": "Slite",
4 "version": "1.0.3", 4 "version": "1.0.4",
5 "license": "MIT", 5 "license": "MIT",
6 "config": { 6 "config": {
7 "serviceURL": "https://{teamId}.slite.com", 7 "serviceURL": "https://{teamId}.slite.com",
diff --git a/recipes/slite/webview.js b/recipes/slite/webview.js
index d892c3c..a044399 100644
--- a/recipes/slite/webview.js
+++ b/recipes/slite/webview.js
@@ -1,15 +1,7 @@
1const getInnerInt = selector => {
2 const element = document.querySelector(selector);
3 return element && parseInt(element.innerText);
4};
5
6module.exports = Ferdi => { 1module.exports = Ferdi => {
7 const getMessages = function getMessages() { 2 const getMessages = function getMessages() {
8 const direct = ( 3 const element = document.querySelector("#app button[data-test-id='notificationsCount']");
9 getInnerInt("#app button[data-test-id='notificationsCount']") || 0 4 Ferdi.setBadge(element ? Ferdi.safeParseInt(element.innerText) : 0);
10 );
11
12 Ferdi.setBadge(direct);
13 }; 5 };
14 6
15 Ferdi.loop(getMessages); 7 Ferdi.loop(getMessages);