Is it possible to add timer in badge on the icon for MV3?
I wanted to try plasmo but not sure if the MV3 which supported by plasmo can have this kind of feature.
When user click on a button on the Content script, it will add a badge showing the timer until the timer runs out.
I’m aware that we can persist the timer by saving the endTime for the timer. But not sure about having a timer running on the service worker.
Or is it only possible on in MV2?
![No description](https://cdn.answeroverflow.com/1148525747108053032/223E0C49-2F84-44A6-BB22-358632AACA1D.png)
13 Replies
how was this possible in MV2 btw?
Also, Plasmo can be bundled for Mv2 as well
Was it possible for Mv2 to mount non-png icons?
Otherwise, it's likely that dev would have to manually add a timer
I think because MV2 has the persistent option so the timer in the “background” can persist
Thats great, thanks
Gave +1 Rep to @louisgv
Actually what I meant by the badge using this https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/browserAction/setBadgeText
Apologies for the confusing
browserAction.setBadgeText() - Mozilla | MDN
Sets the badge text for the browser action. The badge is displayed on top of the icon.
We already done it in MV2 but not with plasmo. Was thinking is it possible to implement that kind of feature in MV3? Sorry if wrong channel
@marlqm has reached level 1. GG!
I'm not entirely sure, but one way I can think of is to use the alert API to keep setting the badge text?
you can technically persist the background page w/ hacks (look at https://github.com/PlasmoHQ/plasmo/tree/main/api/persistent) .. but otherwise you can do setTimeout from bg AND/OR an every minute alert that coordinates
@filthytone has reached level 2. GG!
one thing to note though w/ that persistent hack (i still want to test this, but i think it's accurate) .. since it keeps the bg worker alive, if you depend on chrome web store updates, it simply won't update until chrome restarts (instead of when the bg worker naturally reloads)
yup that's correct
That’s awesome. Never thought Plasmo have that kind of feature. Thanks guys @filthytone @louisgv I will try it
Gave +1 Rep to @filthytone