From 5f3af74c078a057f9bf50d5e5d936d2dfb445f7b Mon Sep 17 00:00:00 2001 From: Thomas Rupprecht Date: Wed, 28 Aug 2019 21:50:01 +0200 Subject: [PATCH] combine updateBadge promises --- background/index.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/background/index.js b/background/index.js index df6ad7b..51eeea8 100644 --- a/background/index.js +++ b/background/index.js @@ -23,16 +23,11 @@ const updateBadge = (open) => { badgeText = browser.browserAction.setBadgeText({text: ''}); badgeColor = browser.browserAction.setBadgeBackgroundColor({color: null}); } - badgeText.then(() => { - - }).catch((error) => { - console.error(error); - }); - badgeColor.then(() => { - - }).catch((error) => { - console.error(error); - }); + Promise.all([badgeText, badgeColor]) + .then() + .catch((error) => { + console.error(error); + }); }; const sendNotification = (open) => {