Hello, I am looking for a way to get a badge to show up after a timed amount when the chrome extension is closed. How can I run "myFunction" in the background.js? The code below is from popup.js
document.addEventListener('DOMContentLoaded', function(){
hide("second")
document.querySelector('#start').addEventListener('click', myFunction);
document.querySelector('#start').addEventListener('click', close);
chrome.browserAction.setBadgeText({"text": "Break Time"});
});
function myFunction(){
setTimeout(function(){
chrome.browserAction.setBadgeText({"text": "5 sec"});
}, 5000);
}
function show(section)
{
document.getElementById(section).style.display = "block";
}
function hide(section)
{
document.getElementById(section).style.display = "none";}
function close() {
hide("time-selection");
window.close();
editing = false;
}