diff options
author | Austin Siew <17107540+Aquafina-water-bottle@users.noreply.github.com> | 2023-03-23 19:32:49 -0600 |
---|---|---|
committer | Austin Siew <17107540+Aquafina-water-bottle@users.noreply.github.com> | 2023-03-23 19:32:49 -0600 |
commit | fef344c1470764243d06e9d8230c88966ee447d5 (patch) | |
tree | de2a05d217ded0acf39e7a66a97c21adb02bf56b /ext | |
parent | e358d21b5a35395d91129102ddc0ce69d8e2f078 (diff) |
fix: renamed action -> browserAction, to support manifest v3
Diffstat (limited to 'ext')
-rw-r--r-- | ext/js/background/backend.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js index c8eb47b9..5f42b4c9 100644 --- a/ext/js/background/backend.js +++ b/ext/js/background/backend.js @@ -1379,16 +1379,16 @@ class Backend { _getBrowserIconTitle() { return ( - isObject(chrome.browserAction) && - typeof chrome.browserAction.getTitle === 'function' ? - new Promise((resolve) => chrome.browserAction.getTitle({}, resolve)) : + isObject(chrome.action) && + typeof chrome.action.getTitle === 'function' ? + new Promise((resolve) => chrome.action.getTitle({}, resolve)) : Promise.resolve('') ); } _updateBadge() { let title = this._defaultBrowserActionTitle; - if (title === null || !isObject(chrome.browserAction)) { + if (title === null || !isObject(chrome.action)) { // Not ready or invalid return; } @@ -1437,17 +1437,17 @@ class Backend { } } - if (color !== null && typeof chrome.browserAction.setBadgeBackgroundColor === 'function') { - chrome.browserAction.setBadgeBackgroundColor({color}); + if (color !== null && typeof chrome.action.setBadgeBackgroundColor === 'function') { + chrome.action.setBadgeBackgroundColor({color}); } - if (text !== null && typeof chrome.browserAction.setBadgeText === 'function') { - chrome.browserAction.setBadgeText({text}); + if (text !== null && typeof chrome.action.setBadgeText === 'function') { + chrome.action.setBadgeText({text}); } - if (typeof chrome.browserAction.setTitle === 'function') { + if (typeof chrome.action.setTitle === 'function') { if (status !== null) { title = `${title} - ${status}`; } - chrome.browserAction.setTitle({title}); + chrome.action.setTitle({title}); } } |