From ae0ad227c0fd293609a21e5cc1d2a4b85fe7c520 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Thu, 19 May 2022 20:16:40 -0400 Subject: Add mode documentation about the types used by Translator (#2147) --- ext/js/background/backend.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'ext/js/background') diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js index 54e8ff08..66f80351 100644 --- a/ext/js/background/backend.js +++ b/ext/js/background/backend.js @@ -1958,6 +1958,13 @@ class Backend { this._applyOptions(source); } + /** + * Creates an options object for use with `Translator.findTerms`. + * @param {string} mode The display mode for the dictionary entries. + * @param {{matchType: string, deinflect: boolean}} details Custom info for finding terms. + * @param {object} options The options. + * @returns {FindTermsOptions} An options object. + */ _getTranslatorFindTermsOptions(mode, details, options) { let {matchType, deinflect} = details; if (typeof matchType !== 'string') { matchType = 'exact'; } @@ -2006,6 +2013,11 @@ class Backend { }; } + /** + * Creates an options object for use with `Translator.findKanji`. + * @param {object} options The options. + * @returns {FindKanjiOptions} An options object. + */ _getTranslatorFindKanjiOptions(options) { const enabledDictionaryMap = this._getTranslatorEnabledDictionaryMap(options); return {enabledDictionaryMap}; -- cgit v1.2.3