From 46799db029e499505ec18cee2b21501fcf3d948a Mon Sep 17 00:00:00 2001 From: Coding Zhang <2291200076@qq.com> Date: Wed, 9 Feb 2022 18:42:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=95=AA=E8=8C=84=E9=92=9F?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=90=8EBadge=E6=98=BE=E7=A4=BA=E6=96=87?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shell-chrome/assets/html/pomodoro/background.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/shell-chrome/assets/html/pomodoro/background.js b/packages/shell-chrome/assets/html/pomodoro/background.js index a3cbb73..f730a0c 100644 --- a/packages/shell-chrome/assets/html/pomodoro/background.js +++ b/packages/shell-chrome/assets/html/pomodoro/background.js @@ -59,7 +59,7 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { minutes: 24, seconds: 60, countdownTimer: "25:00", - status:"init" + status: "init" }, }); } else { @@ -120,7 +120,14 @@ function countdown({ minutes, seconds, status }) { //设置badge文本用来显示剩余分钟数 chrome.storage.sync.get("pomoData", ({ pomoData }) => { - chrome.browserAction.setBadgeText({ text: pomoData.minutes.toString() + ":" + pomoData.seconds.toString() }); + if (pomoData.minutes == 0 && pomoData.seconds == 0) { + chrome.browserAction.setBadgeText({ text: "√" }); + setTimeout(() => { + chrome.browserAction.setBadgeText({ text: "" }); + }, 2000) + } else { + chrome.browserAction.setBadgeText({ text: pomoData.minutes.toString() + ":" + pomoData.seconds.toString() }); + } }); console.log(currentTimer);