aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/js/background/backend.js14
-rw-r--r--types/ext/backend.d.ts2
2 files changed, 9 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) {
diff --git a/types/ext/backend.d.ts b/types/ext/backend.d.ts
index c7d66522..da4deb49 100644
--- a/types/ext/backend.d.ts
+++ b/types/ext/backend.d.ts
@@ -37,3 +37,5 @@ export type CanAddResults = {
canAddArray: {note: import('anki').Note, isDuplicate: boolean}[];
cannotAddArray: import('anki').Note[];
};
+
+export type Mode = 'existingOrNewTab' | 'newTab' | 'popup';