This code switches the title between "this" and "that" each time the user clicks the browser action
function toggleTitle(title) {
if (title == "this") {
browser.sidebarAction.setTitle({title: "that"});
} else {
browser.sidebarAction.setTitle({title: "this"});
}
}
browser.browserAction.onClicked.addListener(() => {
let gettingTitle = browser.sidebarAction.getTitle({});
gettingTitle.then(toggleTitle);
});
Note: This API is based on Opera's chrome.sidebarAction
API.
Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.