Camille Kanza
Camille Kanza

Reputation: 13

How to do interactive notification on chrome plugin

I am currently about to complete the development of a chrome plugin. I 'd like to know if there is a way to display notifications on the icon of the plugin , calling an external web service?

Here is a small example : chrome plugin = > webservices calling => Webservices returns => icon number update

image example

The following line of code displays notifications on the plugin tab

chrome.browserAction.setBadgeBackgroundColor({ color: [255, 0, 0, 255] }); chrome.browserAction.setBadgeText({text: "2+"});

Anyone have an idea ? Thank you in advance

Upvotes: 0

Views: 42

Answers (1)

Camille Kanza
Camille Kanza

Reputation: 13

I found this and it works fine.

window.addEventListener('load', function(){
setInterval(function() {
chrome.browserAction.setBadgeBackgroundColor({ color: [255, 0, 0, 255] });
chrome.browserAction.setBadgeText({text: "2"});
}, 3000);
});

Upvotes: 1

Related Questions