aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-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 3e821333..474365ae 100644
--- a/ext/bg/js/api.js
+++ b/ext/bg/js/api.js
@@ -105,11 +105,8 @@ async function apiTextParseMecab(text, optionsContext) {
return results;
}
-async function apiKanjiFind(text, optionsContext) {
- const options = await apiOptionsGet(optionsContext);
- const definitions = await utilBackend().translator.findKanji(text, options);
- definitions.splice(options.general.maxResults);
- return definitions;
+function apiKanjiFind(text, optionsContext) {
+ return utilBackend()._onApiKanjiFind({text, optionsContext});
}
async function apiDefinitionAdd(definition, mode, context, optionsContext) {
diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js
index 5753e16e..0cac68f8 100644
--- a/ext/bg/js/backend.js
+++ b/ext/bg/js/backend.js
@@ -240,8 +240,11 @@ class Backend {
this.onOptionsUpdated(source);
}
- _onApiKanjiFind({text, optionsContext}) {
- return apiKanjiFind(text, optionsContext);
+ async _onApiKanjiFind({text, optionsContext}) {
+ const options = await this.getOptions(optionsContext);
+ const definitions = await this.translator.findKanji(text, options);
+ definitions.splice(options.general.maxResults);
+ return definitions;
}
_onApiTermsFind({text, details, optionsContext}) {