aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/api.js7
-rw-r--r--ext/bg/js/backend.js7
2 files changed, 7 insertions, 7 deletions
diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js
index 474365ae..d361bde7 100644
--- a/ext/bg/js/api.js
+++ b/ext/bg/js/api.js
@@ -33,11 +33,8 @@ function apiOptionsSave(source) {
return utilBackend()._onApiOptionsSave({source});
}
-async function apiTermsFind(text, details, optionsContext) {
- const options = await apiOptionsGet(optionsContext);
- const [definitions, length] = await utilBackend().translator.findTerms(text, details, options);
- definitions.splice(options.general.maxResults);
- return {length, definitions};
+function apiTermsFind(text, details, optionsContext) {
+ return utilBackend()._onApiTermsFind({text, details, optionsContext});
}
async function apiTextParse(text, optionsContext) {
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index 0cac68f8..4c3b3dfa 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -247,8 +247,11 @@ class Backend {
return definitions;
}
- _onApiTermsFind({text, details, optionsContext}) {
- return apiTermsFind(text, details, optionsContext);
+ async _onApiTermsFind({text, details, optionsContext}) {
+ const options = await this.getOptions(optionsContext);
+ const [definitions, length] = await this.translator.findTerms(text, details, options);
+ definitions.splice(options.general.maxResults);
+ return {length, definitions};
}
_onApiTextParse({text, optionsContext}) {