aboutsummaryrefslogtreecommitdiff
path: root/ext/js/background/backend.js
diff options
context:
space:
mode:
authorBrandon Rainey <83629154+brandonrainey@users.noreply.github.com>2024-05-28 12:19:43 -0400
committerGitHub <noreply@github.com>2024-05-28 16:19:43 +0000
commit538ffccfae85116228e3f986a1659add927adf69 (patch)
tree6dcf04f3fbaf5f7fb261b38a92e12c025adadf6f /ext/js/background/backend.js
parente1c3613da0189c9c234d59d4474cfc3f958af79d (diff)
Change mode to enum (#992)
* converted mode to an enum * converted mode to an enum * created a Mode type in backend.d.ts, reverted enum in backend.js to use this type instead * removed old comment
Diffstat (limited to 'ext/js/background/backend.js')
-rw-r--r--ext/js/background/backend.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js
index b9e23cbb..da720315 100644
--- a/ext/js/background/backend.js
+++ b/ext/js/background/backend.js
@@ -970,10 +970,10 @@ export class Backend {
// Command handlers
/**
- * @param {undefined|{mode: 'existingOrNewTab'|'newTab'|'popup', query?: string}} params
+ * @param {undefined|{mode: import('backend').Mode, query?: string}} params
*/
async _onCommandOpenSearchPage(params) {
- /** @type {'existingOrNewTab'|'newTab'|'popup'} */
+ /** @type {import('backend').Mode} */
let mode = 'existingOrNewTab';
let query = '';
if (typeof params === 'object' && params !== null) {
@@ -1042,10 +1042,10 @@ export class Backend {
}
/**
- * @param {undefined|{mode: 'existingOrNewTab'|'newTab'|'popup'}} params
+ * @param {undefined|{mode: import('backend').Mode}} params
*/
async _onCommandOpenSettingsPage(params) {
- /** @type {'existingOrNewTab'|'newTab'|'popup'} */
+ /** @type {import('backend').Mode} */
let mode = 'existingOrNewTab';
if (typeof params === 'object' && params !== null) {
mode = this._normalizeOpenSettingsPageMode(params.mode, mode);
@@ -2552,7 +2552,7 @@ export class Backend {
}
/**
- * @param {'existingOrNewTab'|'newTab'|'popup'} mode
+ * @param {import('backend').Mode} mode
*/
async _openSettingsPage(mode) {
const manifest = chrome.runtime.getManifest();
@@ -2681,8 +2681,8 @@ export class Backend {
/**
* @param {unknown} mode
- * @param {'existingOrNewTab'|'newTab'|'popup'} defaultValue
- * @returns {'existingOrNewTab'|'newTab'|'popup'}
+ * @param {import('backend').Mode} defaultValue
+ * @returns {import('backend').Mode}
*/
_normalizeOpenSettingsPageMode(mode, defaultValue) {
switch (mode) {